From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-sn1nam02on0102.outbound.protection.outlook.com ([104.47.36.102]:5120 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1032319AbeCAPen (ORCPT ); Thu, 1 Mar 2018 10:34:43 -0500 From: Sasha Levin To: "stable@vger.kernel.org" , "stable-commits@vger.kernel.org" CC: Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [added to the 4.1 stable tree] media: v4l2-ioctl.c: don't copy back the result for -ENOTTY Date: Thu, 1 Mar 2018 15:26:08 +0000 Message-ID: <20180301152116.1486-336-alexander.levin@microsoft.com> References: <20180301152116.1486-1-alexander.levin@microsoft.com> In-Reply-To: <20180301152116.1486-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Hans Verkuil This patch has been added to the 4.1 stable tree. If you have any objections, please let us know. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D [ Upstream commit 181a4a2d5a0a7b43cab08a70710d727e7764ccdd ] If the ioctl returned -ENOTTY, then don't bother copying back the result as there is no point. Signed-off-by: Hans Verkuil Acked-by: Sakari Ailus Cc: # for v4.15 and up Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/v4l2-core/v4l2-ioctl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core= /v4l2-ioctl.c index aa407cb5f830..7004477e7ffc 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -2552,8 +2552,11 @@ video_usercopy(struct file *file, unsigned int cmd, = unsigned long arg, =20 /* Handles IOCTL */ err =3D func(file, cmd, parg); - if (err =3D=3D -ENOIOCTLCMD) + if (err =3D=3D -ENOTTY || err =3D=3D -ENOIOCTLCMD) { err =3D -ENOTTY; + goto out; + } + if (err =3D=3D 0) { if (cmd =3D=3D VIDIOC_DQBUF) trace_v4l2_dqbuf(video_devdata(file)->minor, parg); --=20 2.14.1