Skip to content

Commit 9481769

Browse files
author
Al Viro
committed
->file_open(): lose cred argument
Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent e3f20ae commit 9481769

6 files changed

Lines changed: 10 additions & 10 deletions

File tree

‎include/linux/lsm_hooks.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1569,7 +1569,7 @@ union security_list_options {
15691569
int (*file_send_sigiotask)(struct task_struct *tsk,
15701570
struct fown_struct *fown, int sig);
15711571
int (*file_receive)(struct file *file);
1572-
int (*file_open)(struct file *file, const struct cred *cred);
1572+
int (*file_open)(struct file *file);
15731573

15741574
int (*task_alloc)(struct task_struct *task, unsigned long clone_flags);
15751575
void (*task_free)(struct task_struct *task);

‎security/apparmor/lsm.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ static int apparmor_inode_getattr(const struct path *path)
395395
return common_perm_cond(OP_GETATTR, path, AA_MAY_GETATTR);
396396
}
397397

398-
static int apparmor_file_open(struct file *file, const struct cred *cred)
398+
static int apparmor_file_open(struct file *file)
399399
{
400400
struct aa_file_ctx *fctx = file_ctx(file);
401401
struct aa_label *label;
@@ -414,7 +414,7 @@ static int apparmor_file_open(struct file *file, const struct cred *cred)
414414
return 0;
415415
}
416416

417-
label = aa_get_newest_cred_label(cred);
417+
label = aa_get_newest_cred_label(file->f_cred);
418418
if (!unconfined(label)) {
419419
struct inode *inode = file_inode(file);
420420
struct path_cond cond = { inode->i_uid, inode->i_mode };

‎security/security.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,7 @@ int security_file_open(struct file *file)
974974
{
975975
int ret;
976976

977-
ret = call_int_hook(file_open, 0, file, file->f_cred);
977+
ret = call_int_hook(file_open, 0, file);
978978
if (ret)
979979
return ret;
980980

‎security/selinux/hooks.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3862,7 +3862,7 @@ static int selinux_file_receive(struct file *file)
38623862
return file_has_perm(cred, file, file_to_av(file));
38633863
}
38643864

3865-
static int selinux_file_open(struct file *file, const struct cred *cred)
3865+
static int selinux_file_open(struct file *file)
38663866
{
38673867
struct file_security_struct *fsec;
38683868
struct inode_security_struct *isec;
@@ -3886,7 +3886,7 @@ static int selinux_file_open(struct file *file, const struct cred *cred)
38863886
* new inode label or new policy.
38873887
* This check is not redundant - do not remove.
38883888
*/
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));
38903890
}
38913891

38923892
/* task security operations */

‎security/smack/smack_lsm.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1927,17 +1927,17 @@ static int smack_file_receive(struct file *file)
19271927
*
19281928
* Returns 0
19291929
*/
1930-
static int smack_file_open(struct file *file, const struct cred *cred)
1930+
static int smack_file_open(struct file *file)
19311931
{
1932-
struct task_smack *tsp = cred->security;
1932+
struct task_smack *tsp = file->f_cred->security;
19331933
struct inode *inode = file_inode(file);
19341934
struct smk_audit_info ad;
19351935
int rc;
19361936

19371937
smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_PATH);
19381938
smk_ad_setfield_u_fs_path(&ad, file->f_path);
19391939
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);
19411941

19421942
return rc;
19431943
}

‎security/tomoyo/tomoyo.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ static int tomoyo_file_fcntl(struct file *file, unsigned int cmd,
320320
*
321321
* Returns 0 on success, negative value otherwise.
322322
*/
323-
static int tomoyo_file_open(struct file *f, const struct cred *cred)
323+
static int tomoyo_file_open(struct file *f)
324324
{
325325
int flags = f->f_flags;
326326
/* Don't check read permission here if called from do_execve(). */

0 commit comments

Comments
 (0)