virtio: nsm: fix raw ioctl copy error path
Subsystems (2)
PATCH 1/1 virtio: nsm: fix raw ioctl copy error path
nsm_dev_ioctl() uses a common exit path which unlocks nsm->lock.
A failed copy_from_user() reaches that path before the mutex is locked.
Return -EFAULT directly for that pre-lock failure.
--- drivers/misc/nsm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/misc/nsm.c +1 -2
@@ -365,9 +365,8 @@ static long nsm_dev_ioctl(struct file *file, unsigned int cmd,return -EINVAL ;/* Copy user argument struct to kernel argument struct */ - r = -EFAULT ;if (copy_from_user (&raw, argp,_IOC_SIZE (cmd))) - goto out; +return -EFAULT ;mutex_lock (&nsm->lock);
Signature · 1 line
2.54.0
Quoted 8 lines · Yousef Alhouseen
nsm_dev_ioctl()uses a common exit path which unlocksnsm->lock.A failed
copy_from_user()reaches that path before the mutex is locked.Return
-EFAULTdirectly for that pre-lock failure.Signed-off-by Yousef Alhouseen <[email protected]>---
Greg Kroah-Hartman
maintainerQuoted 10 lines · Yousef Alhouseen
nsm_dev_ioctl()uses a common exit path which unlocksnsm->lock.A failed
copy_from_user()reaches that path before the mutex is locked.Return
-EFAULTdirectly for that pre-lock failure.Signed-off-by Yousef Alhouseen <[email protected]>--- drivers/misc/nsm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
The subject says "virtio" yet that is not what this driver is :(
Can you fix that up and resend?
thanks,
greg k-h
Yes, sorry about that. The prefix should be "virt: nsm", not "virtio:
nsm". I'll fix the subject and resend it as v2.
Thanks,
Yousef
Quoted 19 lines · Greg Kroah-Hartman
Quoted 10 lines · Yousef Alhouseen
nsm_dev_ioctl()uses a common exit path which unlocksnsm->lock.A failed
copy_from_user()reaches that path before the mutex is locked.Return
-EFAULTdirectly for that pre-lock failure.Signed-off-by Yousef Alhouseen <[email protected]>---
drivers/misc/nsm.c| 3 +--1 file changed, 1 insertion(+), 2 deletions(-)The subject says "virtio" yet that is not what this driver is :(
Can you fix that up and resend?
thanks,
greg k-h