1 From 181a4a2d5a0a7b43cab08a70710d727e7764ccdd Mon Sep 17 00:00:00 2001
2 From: Hans Verkuil <hans.verkuil@cisco.com>
3 Date: Tue, 30 Jan 2018 03:50:01 -0500
4 Subject: media: v4l2-ioctl.c: don't copy back the result for -ENOTTY
6 From: Hans Verkuil <hans.verkuil@cisco.com>
8 commit 181a4a2d5a0a7b43cab08a70710d727e7764ccdd upstream.
10 If the ioctl returned -ENOTTY, then don't bother copying
11 back the result as there is no point.
13 Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
14 Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
15 Cc: <stable@vger.kernel.org> # for v4.15 and up
16 Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
17 Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
18 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 drivers/media/v4l2-core/v4l2-ioctl.c | 5 ++++-
22 1 file changed, 4 insertions(+), 1 deletion(-)
24 --- a/drivers/media/v4l2-core/v4l2-ioctl.c
25 +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
26 @@ -2539,8 +2539,11 @@ video_usercopy(struct file *file, unsign
29 err = func(file, cmd, parg);
30 - if (err == -ENOIOCTLCMD)
31 + if (err == -ENOTTY || err == -ENOIOCTLCMD) {
37 if (cmd == VIDIOC_DQBUF)
38 trace_v4l2_dqbuf(video_devdata(file)->minor, parg);