]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
Smack:- Use overlay inode label in smack_inode_copy_up()
authorVishal Goel <vishal.goel@samsung.com>
Fri, 17 Sep 2021 07:38:14 +0000 (13:08 +0530)
committerCasey Schaufler <casey@schaufler-ca.com>
Tue, 28 Sep 2021 20:29:40 +0000 (13:29 -0700)
Currently in "smack_inode_copy_up()" function, process label is
changed with the label on parent inode. Due to which,
process is assigned directory label and whatever file or directory
created by the process are also getting directory label
which is wrong label.

Changes has been done to use label of overlay inode instead
of parent inode.

Signed-off-by: Vishal Goel <vishal.goel@samsung.com>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
security/smack/smack_lsm.c

index 95bd604c381999e3c9ad0f4448a3b92dc39538b2..5ea4815a02426de57ce1ac7329ba83a6c9650ca2 100644 (file)
@@ -4637,7 +4637,7 @@ static int smack_inode_copy_up(struct dentry *dentry, struct cred **new)
        /*
         * Get label from overlay inode and set it in create_sid
         */
-       isp = smack_inode(d_inode(dentry->d_parent));
+       isp = smack_inode(d_inode(dentry));
        skp = isp->smk_inode;
        tsp->smk_task = skp;
        *new = new_creds;