From: Andreas Gruenbacher Date: Sun, 4 Oct 2015 17:18:50 +0000 (+0200) Subject: jffs2: Add missing capability check for listing trusted xattrs X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=bf781714b3e1421a0ebcd0137d081e6566a89f15;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Reviewed-by: Christoph Hellwig Cc: David Woodhouse Cc: linux-mtd@lists.infradead.org Signed-off-by: Al Viro --- diff --git a/fs/jffs2/xattr_trusted.c b/fs/jffs2/xattr_trusted.c index ceaf9c693225..bbd20c16090e 100644 --- a/fs/jffs2/xattr_trusted.c +++ b/fs/jffs2/xattr_trusted.c @@ -39,6 +39,9 @@ static size_t jffs2_trusted_listxattr(struct dentry *dentry, char *list, { size_t retlen = XATTR_TRUSTED_PREFIX_LEN + name_len + 1; + if (!capable(CAP_SYS_ADMIN)) + return 0; + if (list && retlen<=list_size) { strcpy(list, XATTR_TRUSTED_PREFIX); strcpy(list + XATTR_TRUSTED_PREFIX_LEN, name);