From: Hans Verkuil Date: Wed, 28 Mar 2018 18:12:32 +0000 (-0300) Subject: media: v4l2-compat-ioctl32.c: don't copy back the result for certain errors X-Git-Tag: submit/tizen/20180417.011414~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b840abbcef4c0d1563b031068bc811a0e5643e59;p=profile%2Fwearable%2Fplatform%2Fkernel%2Flinux-3.18-exynos7270.git media: v4l2-compat-ioctl32.c: don't copy back the result for certain errors 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 Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman [sw0312.kim: cherry-pick from linux-3.18.y to apply CVE patch] Signed-off-by: Seung-Woo Kim Change-Id: I1454b74c7f56e73bef2349528d68d15927fba359 --- diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c index d8a2c755cd8..b4fade8de45 100644 --- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c +++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c @@ -947,6 +947,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. */