Skip to content

Commit bf78171

Browse files
Andreas GruenbacherAl Viro
Andreas Gruenbacher
authored and
Al Viro
committed
jffs2: Add missing capability check for listing trusted xattrs
The vfs checks if a task has the appropriate access for get and set operations, but it cannot do that for the list operation; the file system must check for that itself. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Cc: David Woodhouse <dwmw2@infradead.org> Cc: linux-mtd@lists.infradead.org Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent e282fb7 commit bf78171

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

fs/jffs2/xattr_trusted.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ static size_t jffs2_trusted_listxattr(struct dentry *dentry, char *list,
3939
{
4040
size_t retlen = XATTR_TRUSTED_PREFIX_LEN + name_len + 1;
4141

42+
if (!capable(CAP_SYS_ADMIN))
43+
return 0;
44+
4245
if (list && retlen<=list_size) {
4346
strcpy(list, XATTR_TRUSTED_PREFIX);
4447
strcpy(list + XATTR_TRUSTED_PREFIX_LEN, name);

0 commit comments

Comments
 (0)