]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - 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
CommitLineData
45be538d
GKH
1From 181a4a2d5a0a7b43cab08a70710d727e7764ccdd Mon Sep 17 00:00:00 2001
2From: Hans Verkuil <hans.verkuil@cisco.com>
3Date: Tue, 30 Jan 2018 03:50:01 -0500
4Subject: media: v4l2-ioctl.c: don't copy back the result for -ENOTTY
5
6From: Hans Verkuil <hans.verkuil@cisco.com>
7
8commit 181a4a2d5a0a7b43cab08a70710d727e7764ccdd upstream.
9
10If the ioctl returned -ENOTTY, then don't bother copying
11back the result as there is no point.
12
13Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
14Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
15Cc: <stable@vger.kernel.org> # for v4.15 and up
16Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
17Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
18Signed-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);