mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-23 12:14:10 +08:00
lsm: correct error codes in security_getselfattr()
We should return -EINVAL if the user specifies LSM_FLAG_SINGLE without supplying a valid lsm_ctx struct buffer. Acked-by: Casey Schaufler <casey@schaufler-ca.com> Reviewed-by: Mickaël Salaün <mic@digikod.net> Signed-off-by: Paul Moore <paul@paul-moore.com>
This commit is contained in:
parent
dc46db78b9
commit
fdcf699b60
@ -3922,9 +3922,9 @@ int security_getselfattr(unsigned int attr, struct lsm_ctx __user *uctx,
|
||||
/*
|
||||
* Only flag supported is LSM_FLAG_SINGLE
|
||||
*/
|
||||
if (flags != LSM_FLAG_SINGLE)
|
||||
if (flags != LSM_FLAG_SINGLE || !uctx)
|
||||
return -EINVAL;
|
||||
if (uctx && copy_from_user(&lctx, uctx, sizeof(lctx)))
|
||||
if (copy_from_user(&lctx, uctx, sizeof(lctx)))
|
||||
return -EFAULT;
|
||||
/*
|
||||
* If the LSM ID isn't specified it is an error.
|
||||
|
Loading…
Reference in New Issue
Block a user