]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ceph: set sec_context xattr on symlink creation
authorJeff Layton <jlayton@kernel.org>
Tue, 28 Jul 2020 14:34:20 +0000 (10:34 -0400)
committerIlya Dryomov <idryomov@gmail.com>
Tue, 4 Aug 2020 17:41:11 +0000 (19:41 +0200)
Symlink inodes should have the security context set in their xattrs on
creation. We already set the context on creation, but we don't attach
the pagelist. The effect is that symlink inodes don't get an SELinux
context set on them at creation, so they end up unlabeled instead of
inheriting the proper context. Make it do so.

Cc: stable@vger.kernel.org
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
fs/ceph/dir.c

index 39f5311404b0815d75ba60c611d18c15e3a392d1..060bdcc5ce32cfa873dc5b084c6caf02c20e9aca 100644 (file)
@@ -930,6 +930,10 @@ static int ceph_symlink(struct inode *dir, struct dentry *dentry,
        req->r_num_caps = 2;
        req->r_dentry_drop = CEPH_CAP_FILE_SHARED | CEPH_CAP_AUTH_EXCL;
        req->r_dentry_unless = CEPH_CAP_FILE_EXCL;
+       if (as_ctx.pagelist) {
+               req->r_pagelist = as_ctx.pagelist;
+               as_ctx.pagelist = NULL;
+       }
        err = ceph_mdsc_do_request(mdsc, dir, req);
        if (!err && !req->r_reply_info.head->is_dentry)
                err = ceph_handle_notrace_create(dir, dentry);