]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ocfs2: trusted xattr missing CAP_SYS_ADMIN check
authorSanidhya Kashyap <sanidhya.gatech@gmail.com>
Tue, 7 Apr 2015 23:43:56 +0000 (09:43 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 7 Apr 2015 23:43:56 +0000 (09:43 +1000)
The trusted extended attributes are only visible to the process which hvae
CAP_SYS_ADMIN capability but the check is missing in ocfs2 xattr_handler
trusted list.  The check is important because this will be used for
implementing mechanisms in the userspace for which other ordinary
processes should not have access to.

Signed-off-by: Sanidhya Kashyap <sanidhya.gatech@gmail.com>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Taesoo kim <taesoo@gatech.edu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/ocfs2/xattr.c

index 4ca7533be479105b51a6952298618f1d73294cf0..3db7da000edad8ea0a8f4988b6c86f82a67036cb 100644 (file)
@@ -7334,6 +7334,9 @@ static size_t ocfs2_xattr_trusted_list(struct dentry *dentry, char *list,
        const size_t prefix_len = XATTR_TRUSTED_PREFIX_LEN;
        const size_t total_len = prefix_len + name_len + 1;
 
+       if (!capable(CAP_SYS_ADMIN))
+               return 0;
+
        if (list && total_len <= list_size) {
                memcpy(list, XATTR_TRUSTED_PREFIX, prefix_len);
                memcpy(list + prefix_len, name, name_len);