Commit fdcf699b authored by Paul Moore's avatar Paul Moore

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: default avatarCasey Schaufler <casey@schaufler-ca.com>
Reviewed-by: default avatarMickaël Salaün <mic@digikod.net>
Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
parent dc46db78
...@@ -3922,9 +3922,9 @@ int security_getselfattr(unsigned int attr, struct lsm_ctx __user *uctx, ...@@ -3922,9 +3922,9 @@ int security_getselfattr(unsigned int attr, struct lsm_ctx __user *uctx,
/* /*
* Only flag supported is LSM_FLAG_SINGLE * Only flag supported is LSM_FLAG_SINGLE
*/ */
if (flags != LSM_FLAG_SINGLE) if (flags != LSM_FLAG_SINGLE || !uctx)
return -EINVAL; return -EINVAL;
if (uctx && copy_from_user(&lctx, uctx, sizeof(lctx))) if (copy_from_user(&lctx, uctx, sizeof(lctx)))
return -EFAULT; return -EFAULT;
/* /*
* If the LSM ID isn't specified it is an error. * If the LSM ID isn't specified it is an error.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment