BACKPORT: Smack: ignore private inode for smack_file_receive
authorSeung-Woo Kim <sw0312.kim@samsung.com>
Fri, 17 Apr 2015 06:25:04 +0000 (15:25 +0900)
committerRafal Krypa <r.krypa@samsung.com>
Mon, 21 Nov 2016 16:02:01 +0000 (17:02 +0100)
The dmabuf fd can be shared between processes via unix domain
socket. The file of dmabuf fd is came from anon_inode. The inode
has no set and get xattr operations, so it can not be shared
between processes with smack. This patch fixes just to ignore
private inode including anon_inode for smack_file_receive.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
(cherry-picked from upstream 9777582e8d604f69ce3a93805065e451487e26b4)

security/smack/smack_lsm.c

index 72a10efd7eb3e0dd7a48fc5adfe2f0e30e9f0f76..7ce602d5357cbd5e239fe08e35d53b71d58f2592 100644 (file)
@@ -1677,6 +1677,9 @@ static int smack_file_receive(struct file *file)
        struct smk_audit_info ad;
        struct inode *inode = file->f_path.dentry->d_inode;
 
+       if (unlikely(IS_PRIVATE(inode)))
+               return 0;
+
        smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_PATH);
        smk_ad_setfield_u_fs_path(&ad, file->f_path);
        /*