diff options
Diffstat (limited to 'security/selinux/hooks.c')
-rw-r--r-- | security/selinux/hooks.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 239b13b442e7..620be0367c0b 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -394,7 +394,7 @@ static int file_alloc_security(struct file *file) | |||
394 | 394 | ||
395 | static void file_free_security(struct file *file) | 395 | static void file_free_security(struct file *file) |
396 | { | 396 | { |
397 | struct file_security_struct *fsec = file->f_security; | 397 | struct file_security_struct *fsec = selinux_file(file); |
398 | file->f_security = NULL; | 398 | file->f_security = NULL; |
399 | kmem_cache_free(file_security_cache, fsec); | 399 | kmem_cache_free(file_security_cache, fsec); |
400 | } | 400 | } |
@@ -1733,7 +1733,7 @@ static int file_has_perm(const struct cred *cred, | |||
1733 | struct file *file, | 1733 | struct file *file, |
1734 | u32 av) | 1734 | u32 av) |
1735 | { | 1735 | { |
1736 | struct file_security_struct *fsec = file->f_security; | 1736 | struct file_security_struct *fsec = selinux_file(file); |
1737 | struct inode *inode = file_inode(file); | 1737 | struct inode *inode = file_inode(file); |
1738 | struct common_audit_data ad; | 1738 | struct common_audit_data ad; |
1739 | u32 sid = cred_sid(cred); | 1739 | u32 sid = cred_sid(cred); |
@@ -2077,7 +2077,7 @@ static int selinux_binder_transfer_file(struct task_struct *from, | |||
2077 | struct file *file) | 2077 | struct file *file) |
2078 | { | 2078 | { |
2079 | u32 sid = task_sid(to); | 2079 | u32 sid = task_sid(to); |
2080 | struct file_security_struct *fsec = file->f_security; | 2080 | struct file_security_struct *fsec = selinux_file(file); |
2081 | struct dentry *dentry = file->f_path.dentry; | 2081 | struct dentry *dentry = file->f_path.dentry; |
2082 | struct inode_security_struct *isec; | 2082 | struct inode_security_struct *isec; |
2083 | struct common_audit_data ad; | 2083 | struct common_audit_data ad; |
@@ -3323,7 +3323,7 @@ static int selinux_revalidate_file_permission(struct file *file, int mask) | |||
3323 | static int selinux_file_permission(struct file *file, int mask) | 3323 | static int selinux_file_permission(struct file *file, int mask) |
3324 | { | 3324 | { |
3325 | struct inode *inode = file_inode(file); | 3325 | struct inode *inode = file_inode(file); |
3326 | struct file_security_struct *fsec = file->f_security; | 3326 | struct file_security_struct *fsec = selinux_file(file); |
3327 | struct inode_security_struct *isec; | 3327 | struct inode_security_struct *isec; |
3328 | u32 sid = current_sid(); | 3328 | u32 sid = current_sid(); |
3329 | 3329 | ||
@@ -3358,7 +3358,7 @@ static int ioctl_has_perm(const struct cred *cred, struct file *file, | |||
3358 | u32 requested, u16 cmd) | 3358 | u32 requested, u16 cmd) |
3359 | { | 3359 | { |
3360 | struct common_audit_data ad; | 3360 | struct common_audit_data ad; |
3361 | struct file_security_struct *fsec = file->f_security; | 3361 | struct file_security_struct *fsec = selinux_file(file); |
3362 | struct inode *inode = file_inode(file); | 3362 | struct inode *inode = file_inode(file); |
3363 | struct inode_security_struct *isec; | 3363 | struct inode_security_struct *isec; |
3364 | struct lsm_ioctlop_audit ioctl; | 3364 | struct lsm_ioctlop_audit ioctl; |
@@ -3610,7 +3610,7 @@ static void selinux_file_set_fowner(struct file *file) | |||
3610 | { | 3610 | { |
3611 | struct file_security_struct *fsec; | 3611 | struct file_security_struct *fsec; |
3612 | 3612 | ||
3613 | fsec = file->f_security; | 3613 | fsec = selinux_file(file); |
3614 | fsec->fown_sid = current_sid(); | 3614 | fsec->fown_sid = current_sid(); |
3615 | } | 3615 | } |
3616 | 3616 | ||
@@ -3625,7 +3625,7 @@ static int selinux_file_send_sigiotask(struct task_struct *tsk, | |||
3625 | /* struct fown_struct is never outside the context of a struct file */ | 3625 | /* struct fown_struct is never outside the context of a struct file */ |
3626 | file = container_of(fown, struct file, f_owner); | 3626 | file = container_of(fown, struct file, f_owner); |
3627 | 3627 | ||
3628 | fsec = file->f_security; | 3628 | fsec = selinux_file(file); |
3629 | 3629 | ||
3630 | if (!signum) | 3630 | if (!signum) |
3631 | perm = signal_to_av(SIGIO); /* as per send_sigio_to_task */ | 3631 | perm = signal_to_av(SIGIO); /* as per send_sigio_to_task */ |
@@ -3649,7 +3649,7 @@ static int selinux_file_open(struct file *file) | |||
3649 | struct file_security_struct *fsec; | 3649 | struct file_security_struct *fsec; |
3650 | struct inode_security_struct *isec; | 3650 | struct inode_security_struct *isec; |
3651 | 3651 | ||
3652 | fsec = file->f_security; | 3652 | fsec = selinux_file(file); |
3653 | isec = inode_security(file_inode(file)); | 3653 | isec = inode_security(file_inode(file)); |
3654 | /* | 3654 | /* |
3655 | * Save inode label and policy sequence number | 3655 | * Save inode label and policy sequence number |
@@ -3788,7 +3788,7 @@ static int selinux_kernel_module_from_file(struct file *file) | |||
3788 | ad.type = LSM_AUDIT_DATA_FILE; | 3788 | ad.type = LSM_AUDIT_DATA_FILE; |
3789 | ad.u.file = file; | 3789 | ad.u.file = file; |
3790 | 3790 | ||
3791 | fsec = file->f_security; | 3791 | fsec = selinux_file(file); |
3792 | if (sid != fsec->sid) { | 3792 | if (sid != fsec->sid) { |
3793 | rc = avc_has_perm(&selinux_state, | 3793 | rc = avc_has_perm(&selinux_state, |
3794 | sid, fsec->sid, SECCLASS_FD, FD__USE, &ad); | 3794 | sid, fsec->sid, SECCLASS_FD, FD__USE, &ad); |