Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 94817692 authored by Al Viro's avatar Al Viro
Browse files

->file_open(): lose cred argument

parent e3f20ae2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1569,7 +1569,7 @@ union security_list_options {
	int (*file_send_sigiotask)(struct task_struct *tsk,
					struct fown_struct *fown, int sig);
	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);
	void (*task_free)(struct task_struct *task);
+2 −2
Original line number Diff line number Diff line
@@ -395,7 +395,7 @@ static int apparmor_inode_getattr(const struct path *path)
	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_label *label;
@@ -414,7 +414,7 @@ static int apparmor_file_open(struct file *file, const struct cred *cred)
		return 0;
	}

	label = aa_get_newest_cred_label(cred);
	label = aa_get_newest_cred_label(file->f_cred);
	if (!unconfined(label)) {
		struct inode *inode = file_inode(file);
		struct path_cond cond = { inode->i_uid, inode->i_mode };
+1 −1
Original line number Diff line number Diff line
@@ -974,7 +974,7 @@ int security_file_open(struct file *file)
{
	int ret;

	ret = call_int_hook(file_open, 0, file, file->f_cred);
	ret = call_int_hook(file_open, 0, file);
	if (ret)
		return ret;

+2 −2
Original line number Diff line number Diff line
@@ -3862,7 +3862,7 @@ static int selinux_file_receive(struct file *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 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.
	 * 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 */
+3 −3
Original line number Diff line number Diff line
@@ -1927,9 +1927,9 @@ static int smack_file_receive(struct file *file)
 *
 * 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 smk_audit_info ad;
	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_setfield_u_fs_path(&ad, file->f_path);
	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;
}
Loading