aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2018-07-10 14:13:18 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2018-07-12 10:04:15 -0400
commit9481769208b5e39b871ae4e89f5328c776ec38dc (patch)
tree5d872c4cf7a436366c4261b67ed39511e20b3d0d
parente3f20ae21079ecac282df65d83865c5771f4bca0 (diff)
->file_open(): lose cred argument
Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--include/linux/lsm_hooks.h2
-rw-r--r--security/apparmor/lsm.c4
-rw-r--r--security/security.c2
-rw-r--r--security/selinux/hooks.c4
-rw-r--r--security/smack/smack_lsm.c6
-rw-r--r--security/tomoyo/tomoyo.c2
6 files changed, 10 insertions, 10 deletions
diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h
index 8f1131c8dd54..a8ee106b865d 100644
--- a/include/linux/lsm_hooks.h
+++ b/include/linux/lsm_hooks.h
@@ -1569,7 +1569,7 @@ union security_list_options {
1569 int (*file_send_sigiotask)(struct task_struct *tsk, 1569 int (*file_send_sigiotask)(struct task_struct *tsk,
1570 struct fown_struct *fown, int sig); 1570 struct fown_struct *fown, int sig);
1571 int (*file_receive)(struct file *file); 1571 int (*file_receive)(struct file *file);
1572 int (*file_open)(struct file *file, const struct cred *cred); 1572 int (*file_open)(struct file *file);
1573 1573
1574 int (*task_alloc)(struct task_struct *task, unsigned long clone_flags); 1574 int (*task_alloc)(struct task_struct *task, unsigned long clone_flags);
1575 void (*task_free)(struct task_struct *task); 1575 void (*task_free)(struct task_struct *task);
diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c
index 74f17376202b..8b8b70620bbe 100644
--- a/security/apparmor/lsm.c
+++ b/security/apparmor/lsm.c
@@ -395,7 +395,7 @@ static int apparmor_inode_getattr(const struct path *path)
395 return common_perm_cond(OP_GETATTR, path, AA_MAY_GETATTR); 395 return common_perm_cond(OP_GETATTR, path, AA_MAY_GETATTR);
396} 396}
397 397
398static int apparmor_file_open(struct file *file, const struct cred *cred) 398static int apparmor_file_open(struct file *file)
399{ 399{
400 struct aa_file_ctx *fctx = file_ctx(file); 400 struct aa_file_ctx *fctx = file_ctx(file);
401 struct aa_label *label; 401 struct aa_label *label;
@@ -414,7 +414,7 @@ static int apparmor_file_open(struct file *file, const struct cred *cred)
414 return 0; 414 return 0;
415 } 415 }
416 416
417 label = aa_get_newest_cred_label(cred); 417 label = aa_get_newest_cred_label(file->f_cred);
418 if (!unconfined(label)) { 418 if (!unconfined(label)) {
419 struct inode *inode = file_inode(file); 419 struct inode *inode = file_inode(file);
420 struct path_cond cond = { inode->i_uid, inode->i_mode }; 420 struct path_cond cond = { inode->i_uid, inode->i_mode };
diff --git a/security/security.c b/security/security.c
index 235b35f58a65..5dce67070cdf 100644
--- a/security/security.c
+++ b/security/security.c
@@ -974,7 +974,7 @@ int security_file_open(struct file *file)
974{ 974{
975 int ret; 975 int ret;
976 976
977 ret = call_int_hook(file_open, 0, file, file->f_cred); 977 ret = call_int_hook(file_open, 0, file);
978 if (ret) 978 if (ret)
979 return ret; 979 return ret;
980 980
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 2b5ee5fbd652..18006be15713 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -3862,7 +3862,7 @@ static int selinux_file_receive(struct file *file)
3862 return file_has_perm(cred, file, file_to_av(file)); 3862 return file_has_perm(cred, file, file_to_av(file));
3863} 3863}
3864 3864
3865static int selinux_file_open(struct file *file, const struct cred *cred) 3865static int selinux_file_open(struct file *file)
3866{ 3866{
3867 struct file_security_struct *fsec; 3867 struct file_security_struct *fsec;
3868 struct inode_security_struct *isec; 3868 struct inode_security_struct *isec;
@@ -3886,7 +3886,7 @@ static int selinux_file_open(struct file *file, const struct cred *cred)
3886 * new inode label or new policy. 3886 * new inode label or new policy.
3887 * This check is not redundant - do not remove. 3887 * This check is not redundant - do not remove.
3888 */ 3888 */
3889 return file_path_has_perm(cred, file, open_file_to_av(file)); 3889 return file_path_has_perm(file->f_cred, file, open_file_to_av(file));
3890} 3890}
3891 3891
3892/* task security operations */ 3892/* task security operations */
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index 7ad226018f51..e7b6c012431d 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -1927,9 +1927,9 @@ static int smack_file_receive(struct file *file)
1927 * 1927 *
1928 * Returns 0 1928 * Returns 0
1929 */ 1929 */
1930static int smack_file_open(struct file *file, const struct cred *cred) 1930static int smack_file_open(struct file *file)
1931{ 1931{
1932 struct task_smack *tsp = cred->security; 1932 struct task_smack *tsp = file->f_cred->security;
1933 struct inode *inode = file_inode(file); 1933 struct inode *inode = file_inode(file);
1934 struct smk_audit_info ad; 1934 struct smk_audit_info ad;
1935 int rc; 1935 int rc;
@@ -1937,7 +1937,7 @@ static int smack_file_open(struct file *file, const struct cred *cred)
1937 smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_PATH); 1937 smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_PATH);
1938 smk_ad_setfield_u_fs_path(&ad, file->f_path); 1938 smk_ad_setfield_u_fs_path(&ad, file->f_path);
1939 rc = smk_tskacc(tsp, smk_of_inode(inode), MAY_READ, &ad); 1939 rc = smk_tskacc(tsp, smk_of_inode(inode), MAY_READ, &ad);
1940 rc = smk_bu_credfile(cred, file, MAY_READ, rc); 1940 rc = smk_bu_credfile(file->f_cred, file, MAY_READ, rc);
1941 1941
1942 return rc; 1942 return rc;
1943} 1943}
diff --git a/security/tomoyo/tomoyo.c b/security/tomoyo/tomoyo.c
index 213b8c593668..9f932e2d6852 100644
--- a/security/tomoyo/tomoyo.c
+++ b/security/tomoyo/tomoyo.c
@@ -320,7 +320,7 @@ static int tomoyo_file_fcntl(struct file *file, unsigned int cmd,
320 * 320 *
321 * Returns 0 on success, negative value otherwise. 321 * Returns 0 on success, negative value otherwise.
322 */ 322 */
323static int tomoyo_file_open(struct file *f, const struct cred *cred) 323static int tomoyo_file_open(struct file *f)
324{ 324{
325 int flags = f->f_flags; 325 int flags = f->f_flags;
326 /* Don't check read permission here if called from do_execve(). */ 326 /* Don't check read permission here if called from do_execve(). */