->file_open(): lose cred argument

Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro 2018-07-10 14:13:18 -04:00
Родитель e3f20ae210
Коммит 9481769208
6 изменённых файлов: 10 добавлений и 10 удалений

Просмотреть файл

@ -1569,7 +1569,7 @@ union security_list_options {
int (*file_send_sigiotask)(struct task_struct *tsk, int (*file_send_sigiotask)(struct task_struct *tsk,
struct fown_struct *fown, int sig); struct fown_struct *fown, int sig);
int (*file_receive)(struct file *file); int (*file_receive)(struct file *file);
int (*file_open)(struct file *file, const struct cred *cred); int (*file_open)(struct file *file);
int (*task_alloc)(struct task_struct *task, unsigned long clone_flags); int (*task_alloc)(struct task_struct *task, unsigned long clone_flags);
void (*task_free)(struct task_struct *task); void (*task_free)(struct task_struct *task);

Просмотреть файл

@ -395,7 +395,7 @@ static int apparmor_inode_getattr(const struct path *path)
return common_perm_cond(OP_GETATTR, path, AA_MAY_GETATTR); return common_perm_cond(OP_GETATTR, path, AA_MAY_GETATTR);
} }
static int apparmor_file_open(struct file *file, const struct cred *cred) static int apparmor_file_open(struct file *file)
{ {
struct aa_file_ctx *fctx = file_ctx(file); struct aa_file_ctx *fctx = file_ctx(file);
struct aa_label *label; struct aa_label *label;
@ -414,7 +414,7 @@ static int apparmor_file_open(struct file *file, const struct cred *cred)
return 0; return 0;
} }
label = aa_get_newest_cred_label(cred); label = aa_get_newest_cred_label(file->f_cred);
if (!unconfined(label)) { if (!unconfined(label)) {
struct inode *inode = file_inode(file); struct inode *inode = file_inode(file);
struct path_cond cond = { inode->i_uid, inode->i_mode }; struct path_cond cond = { inode->i_uid, inode->i_mode };

Просмотреть файл

@ -974,7 +974,7 @@ int security_file_open(struct file *file)
{ {
int ret; int ret;
ret = call_int_hook(file_open, 0, file, file->f_cred); ret = call_int_hook(file_open, 0, file);
if (ret) if (ret)
return ret; return ret;

Просмотреть файл

@ -3862,7 +3862,7 @@ static int selinux_file_receive(struct file *file)
return file_has_perm(cred, file, file_to_av(file)); return file_has_perm(cred, file, file_to_av(file));
} }
static int selinux_file_open(struct file *file, const struct cred *cred) static int selinux_file_open(struct file *file)
{ {
struct file_security_struct *fsec; struct file_security_struct *fsec;
struct inode_security_struct *isec; struct inode_security_struct *isec;
@ -3886,7 +3886,7 @@ static int selinux_file_open(struct file *file, const struct cred *cred)
* new inode label or new policy. * new inode label or new policy.
* This check is not redundant - do not remove. * This check is not redundant - do not remove.
*/ */
return file_path_has_perm(cred, file, open_file_to_av(file)); return file_path_has_perm(file->f_cred, file, open_file_to_av(file));
} }
/* task security operations */ /* task security operations */

Просмотреть файл

@ -1927,9 +1927,9 @@ static int smack_file_receive(struct file *file)
* *
* Returns 0 * Returns 0
*/ */
static int smack_file_open(struct file *file, const struct cred *cred) static int smack_file_open(struct file *file)
{ {
struct task_smack *tsp = cred->security; struct task_smack *tsp = file->f_cred->security;
struct inode *inode = file_inode(file); struct inode *inode = file_inode(file);
struct smk_audit_info ad; struct smk_audit_info ad;
int rc; int rc;
@ -1937,7 +1937,7 @@ static int smack_file_open(struct file *file, const struct cred *cred)
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_tskacc(tsp, smk_of_inode(inode), MAY_READ, &ad); rc = smk_tskacc(tsp, smk_of_inode(inode), MAY_READ, &ad);
rc = smk_bu_credfile(cred, file, MAY_READ, rc); rc = smk_bu_credfile(file->f_cred, file, MAY_READ, rc);
return rc; return rc;
} }

Просмотреть файл

@ -320,7 +320,7 @@ static int tomoyo_file_fcntl(struct file *file, unsigned int cmd,
* *
* Returns 0 on success, negative value otherwise. * Returns 0 on success, negative value otherwise.
*/ */
static int tomoyo_file_open(struct file *f, const struct cred *cred) static int tomoyo_file_open(struct file *f)
{ {
int flags = f->f_flags; int flags = f->f_flags;
/* Don't check read permission here if called from do_execve(). */ /* Don't check read permission here if called from do_execve(). */