diff options
author | Arnd Bergmann <arnd@arndb.de> | 2020-01-08 11:00:00 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2020-01-08 13:27:58 +0100 |
commit | 1dc8b65c944e5cfce3d830a5b97b42be185a1984 (patch) | |
tree | ef39a9c754f0f74fc9efab6e598b52dbe1b44945 /drivers/media/v4l2-core | |
parent | e4b9b6454d94481483c435b94517249b79e82b63 (diff) | |
download | linux-stable-1dc8b65c944e5cfce3d830a5b97b42be185a1984.tar.gz linux-stable-1dc8b65c944e5cfce3d830a5b97b42be185a1984.tar.bz2 linux-stable-1dc8b65c944e5cfce3d830a5b97b42be185a1984.zip |
media: v4l2-core: only zero-out ioctl-read buffers
The memset() got moved out of the check for _IOC_NONE, so passing a
made-up command number with a size but no direction would allow clearing
data on user-provided pointers.
Move video_get_user() back into the _IOC_NONE check where it belongs.
Reported-by: syzbot+54fd8cca4b7226c94b8e@syzkaller.appspotmail.com
Fixes: 6c625c01c7a6 ("media: v4l2-core: split out data copy from video_usercopy")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media/v4l2-core')
-rw-r--r-- | drivers/media/v4l2-core/v4l2-ioctl.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index b68ff06009cd..aaf83e254272 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -3205,12 +3205,12 @@ video_usercopy(struct file *file, unsigned int orig_cmd, unsigned long arg, parg = mbuf; } + err = video_get_user((void __user *)arg, parg, orig_cmd, + &always_copy); + if (err) + goto out; } - err = video_get_user((void __user *)arg, parg, orig_cmd, &always_copy); - if (err) - goto out; - err = check_array_args(cmd, parg, &array_size, &user_ptr, &kernel_ptr); if (err < 0) goto out; |