]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.18.103/media-v4l2-ioctl.c-don-t-copy-back-the-result-for-enotty.patch
Linux 4.14.95
[thirdparty/kernel/stable-queue.git] / releases / 3.18.103 / media-v4l2-ioctl.c-don-t-copy-back-the-result-for-enotty.patch
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
5
6 From: Hans Verkuil <hans.verkuil@cisco.com>
7
8 commit 181a4a2d5a0a7b43cab08a70710d727e7764ccdd upstream.
9
10 If the ioctl returned -ENOTTY, then don't bother copying
11 back the result as there is no point.
12
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>
19
20 ---
21 drivers/media/v4l2-core/v4l2-ioctl.c | 5 ++++-
22 1 file changed, 4 insertions(+), 1 deletion(-)
23
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
27
28 /* Handles IOCTL */
29 err = func(file, cmd, parg);
30 - if (err == -ENOIOCTLCMD)
31 + if (err == -ENOTTY || err == -ENOIOCTLCMD) {
32 err = -ENOTTY;
33 + goto out;
34 + }
35 +
36 if (err == 0) {
37 if (cmd == VIDIOC_DQBUF)
38 trace_v4l2_dqbuf(video_devdata(file)->minor, parg);