From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from lb3-smtp-cloud9.xs4all.net ([194.109.24.30]:38981 "EHLO lb3-smtp-cloud9.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967464AbeBNLoh (ORCPT ); Wed, 14 Feb 2018 06:44:37 -0500 From: Hans Verkuil To: stable@vger.kernel.org Cc: linux-media@vger.kernel.org, Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH for v4.14 11/13] media: v4l2-compat-ioctl32.c: don't copy back the result for certain errors Date: Wed, 14 Feb 2018 12:44:32 +0100 Message-Id: <20180214114434.26842-12-hverkuil@xs4all.nl> In-Reply-To: <20180214114434.26842-1-hverkuil@xs4all.nl> References: <20180214114434.26842-1-hverkuil@xs4all.nl> Sender: linux-media-owner@vger.kernel.org List-ID: From: Hans Verkuil commit d83a8243aaefe62ace433e4384a4f077bed86acb upstream. Some ioctls need to copy back the result even if the ioctl returned an error. However, don't do this for the error code -ENOTTY. It makes no sense in that cases. Signed-off-by: Hans Verkuil Acked-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c index bef9c990c9bd..5603c7c1edd5 100644 --- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c +++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c @@ -968,6 +968,9 @@ static long do_video_ioctl(struct file *file, unsigned int cmd, unsigned long ar set_fs(old_fs); } + if (err == -ENOTTY) + return err; + /* Special case: even after an error we need to put the results back for these ioctls since the error_idx will contain information on which control failed. */ -- 2.15.1