mirror of
https://github.com/fail0verflow/switch-linux.git
synced 2025-05-04 02:34:21 -04:00
Smack: ignore private inode for file functions
The access to fd from anon_inode is always failed because there is no set xattr operations. So this patch fixes to ignore private inode including anon_inode for file functions. It was only ignored for smack_file_receive() to share dma-buf fd, but dma-buf has other functions like ioctl and mmap. Reference: https://lkml.org/lkml/2015/4/17/16 Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
This commit is contained in:
parent
805b65a80b
commit
83a1e53f39
1 changed files with 12 additions and 0 deletions
|
@ -1647,6 +1647,9 @@ static int smack_file_ioctl(struct file *file, unsigned int cmd,
|
||||||
struct smk_audit_info ad;
|
struct smk_audit_info ad;
|
||||||
struct inode *inode = file_inode(file);
|
struct inode *inode = file_inode(file);
|
||||||
|
|
||||||
|
if (unlikely(IS_PRIVATE(inode)))
|
||||||
|
return 0;
|
||||||
|
|
||||||
smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_PATH);
|
smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_PATH);
|
||||||
smk_ad_setfield_u_fs_path(&ad, file->f_path);
|
smk_ad_setfield_u_fs_path(&ad, file->f_path);
|
||||||
|
|
||||||
|
@ -1676,6 +1679,9 @@ static int smack_file_lock(struct file *file, unsigned int cmd)
|
||||||
int rc;
|
int rc;
|
||||||
struct inode *inode = file_inode(file);
|
struct inode *inode = file_inode(file);
|
||||||
|
|
||||||
|
if (unlikely(IS_PRIVATE(inode)))
|
||||||
|
return 0;
|
||||||
|
|
||||||
smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_PATH);
|
smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_PATH);
|
||||||
smk_ad_setfield_u_fs_path(&ad, file->f_path);
|
smk_ad_setfield_u_fs_path(&ad, file->f_path);
|
||||||
rc = smk_curacc(smk_of_inode(inode), MAY_LOCK, &ad);
|
rc = smk_curacc(smk_of_inode(inode), MAY_LOCK, &ad);
|
||||||
|
@ -1702,6 +1708,9 @@ static int smack_file_fcntl(struct file *file, unsigned int cmd,
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
struct inode *inode = file_inode(file);
|
struct inode *inode = file_inode(file);
|
||||||
|
|
||||||
|
if (unlikely(IS_PRIVATE(inode)))
|
||||||
|
return 0;
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case F_GETLK:
|
case F_GETLK:
|
||||||
break;
|
break;
|
||||||
|
@ -1755,6 +1764,9 @@ static int smack_mmap_file(struct file *file,
|
||||||
if (file == NULL)
|
if (file == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if (unlikely(IS_PRIVATE(file_inode(file))))
|
||||||
|
return 0;
|
||||||
|
|
||||||
isp = file_inode(file)->i_security;
|
isp = file_inode(file)->i_security;
|
||||||
if (isp->smk_mmap == NULL)
|
if (isp->smk_mmap == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue