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

->getprocattr(): attribute name is const char *, TYVM...



cast of ->d_name.name to char * is completely wrong - nothing is
allowed to modify its contents.

Reviewed-by: default avatarChristian Brauner (Microsoft) <brauner@kernel.org>
Acked-by: default avatarPaul Moore <paul@paul-moore.com>
Acked-by: default avatarCasey Schaufler <casey@schaufler-ca.com>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 568035b0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2728,7 +2728,7 @@ static ssize_t proc_pid_attr_read(struct file * file, char __user * buf,
		return -ESRCH;

	length = security_getprocattr(task, PROC_I(inode)->op.lsm,
				      (char*)file->f_path.dentry->d_name.name,
				      file->f_path.dentry->d_name.name,
				      &p);
	put_task_struct(task);
	if (length > 0)
+1 −1
Original line number Diff line number Diff line
@@ -253,7 +253,7 @@ LSM_HOOK(int, 0, sem_semop, struct kern_ipc_perm *perm, struct sembuf *sops,
LSM_HOOK(int, 0, netlink_send, struct sock *sk, struct sk_buff *skb)
LSM_HOOK(void, LSM_RET_VOID, d_instantiate, struct dentry *dentry,
	 struct inode *inode)
LSM_HOOK(int, -EINVAL, getprocattr, struct task_struct *p, char *name,
LSM_HOOK(int, -EINVAL, getprocattr, struct task_struct *p, const char *name,
	 char **value)
LSM_HOOK(int, -EINVAL, setprocattr, const char *name, void *value, size_t size)
LSM_HOOK(int, 0, ismaclabel, const char *name)
+2 −2
Original line number Diff line number Diff line
@@ -461,7 +461,7 @@ int security_sem_semctl(struct kern_ipc_perm *sma, int cmd);
int security_sem_semop(struct kern_ipc_perm *sma, struct sembuf *sops,
			unsigned nsops, int alter);
void security_d_instantiate(struct dentry *dentry, struct inode *inode);
int security_getprocattr(struct task_struct *p, const char *lsm, char *name,
int security_getprocattr(struct task_struct *p, const char *lsm, const char *name,
			 char **value);
int security_setprocattr(const char *lsm, const char *name, void *value,
			 size_t size);
@@ -1301,7 +1301,7 @@ static inline void security_d_instantiate(struct dentry *dentry,
{ }

static inline int security_getprocattr(struct task_struct *p, const char *lsm,
				       char *name, char **value)
				       const char *name, char **value)
{
	return -EINVAL;
}
+1 −1
Original line number Diff line number Diff line
@@ -614,7 +614,7 @@ static int apparmor_sb_pivotroot(const struct path *old_path,
	return error;
}

static int apparmor_getprocattr(struct task_struct *task, char *name,
static int apparmor_getprocattr(struct task_struct *task, const char *name,
				char **value)
{
	int error = -ENOENT;
+2 −2
Original line number Diff line number Diff line
@@ -2057,8 +2057,8 @@ void security_d_instantiate(struct dentry *dentry, struct inode *inode)
}
EXPORT_SYMBOL(security_d_instantiate);

int security_getprocattr(struct task_struct *p, const char *lsm, char *name,
				char **value)
int security_getprocattr(struct task_struct *p, const char *lsm,
			 const char *name, char **value)
{
	struct security_hook_list *hp;

Loading