From: Greg Kroah-Hartman Date: Tue, 3 Apr 2018 17:46:20 +0000 (+0200) Subject: 3.18-stable patches X-Git-Tag: v3.18.103~28 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=45be538d021654670748fa9fa1858d9e90dd29c3;p=thirdparty%2Fkernel%2Fstable-queue.git 3.18-stable patches added patches: media-v4l2-ioctl.c-don-t-copy-back-the-result-for-enotty.patch vb2-v4l2_buf_flag_done-is-set-after-dqbuf.patch --- diff --git a/queue-3.18/media-v4l2-ioctl.c-don-t-copy-back-the-result-for-enotty.patch b/queue-3.18/media-v4l2-ioctl.c-don-t-copy-back-the-result-for-enotty.patch new file mode 100644 index 00000000000..7f77480f2cd --- /dev/null +++ b/queue-3.18/media-v4l2-ioctl.c-don-t-copy-back-the-result-for-enotty.patch @@ -0,0 +1,38 @@ +From 181a4a2d5a0a7b43cab08a70710d727e7764ccdd Mon Sep 17 00:00:00 2001 +From: Hans Verkuil +Date: Tue, 30 Jan 2018 03:50:01 -0500 +Subject: media: v4l2-ioctl.c: don't copy back the result for -ENOTTY + +From: Hans Verkuil + +commit 181a4a2d5a0a7b43cab08a70710d727e7764ccdd upstream. + +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 +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/media/v4l2-core/v4l2-ioctl.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/drivers/media/v4l2-core/v4l2-ioctl.c ++++ b/drivers/media/v4l2-core/v4l2-ioctl.c +@@ -2539,8 +2539,11 @@ video_usercopy(struct file *file, unsign + + /* Handles IOCTL */ + err = func(file, cmd, parg); +- if (err == -ENOIOCTLCMD) ++ if (err == -ENOTTY || err == -ENOIOCTLCMD) { + err = -ENOTTY; ++ goto out; ++ } ++ + if (err == 0) { + if (cmd == VIDIOC_DQBUF) + trace_v4l2_dqbuf(video_devdata(file)->minor, parg); diff --git a/queue-3.18/series b/queue-3.18/series index e056ffd280c..1f8be5947bf 100644 --- a/queue-3.18/series +++ b/queue-3.18/series @@ -54,3 +54,5 @@ netfilter-bridge-ebt_among-add-more-missing-match-size-checks.patch netfilter-x_tables-add-and-use-xt_check_proc_name.patch bluetooth-fix-missing-encryption-refresh-on-security-request.patch scsi-virtio_scsi-always-read-vpd-pages-for-multiqueue-too.patch +media-v4l2-ioctl.c-don-t-copy-back-the-result-for-enotty.patch +vb2-v4l2_buf_flag_done-is-set-after-dqbuf.patch diff --git a/queue-3.18/vb2-v4l2_buf_flag_done-is-set-after-dqbuf.patch b/queue-3.18/vb2-v4l2_buf_flag_done-is-set-after-dqbuf.patch new file mode 100644 index 00000000000..6aebf6b5bfb --- /dev/null +++ b/queue-3.18/vb2-v4l2_buf_flag_done-is-set-after-dqbuf.patch @@ -0,0 +1,50 @@ +From 3171cc2b4eb9831ab4df1d80d0410a945b8bc84e Mon Sep 17 00:00:00 2001 +From: Ricardo Ribalda +Date: Mon, 20 Jun 2016 09:47:22 -0300 +Subject: [media] vb2: V4L2_BUF_FLAG_DONE is set after DQBUF + +From: Ricardo Ribalda + +commit 3171cc2b4eb9831ab4df1d80d0410a945b8bc84e upstream. + +According to the doc, V4L2_BUF_FLAG_DONE is cleared after DQBUF: + +V4L2_BUF_FLAG_DONE 0x00000004 ... After calling the VIDIOC_QBUF or +VIDIOC_DQBUF it is always cleared ... + +Unfortunately, it seems that videobuf2 keeps it set after DQBUF. This +can be tested with vivid and dev_debug: + +[257604.338082] video1: VIDIOC_DQBUF: 71:33:25.00260479 index=3, +type=vid-cap, flags=0x00002004, field=none, sequence=163, +memory=userptr, bytesused=460800, offset/userptr=0x344b000, +length=460800 + +This patch forces FLAG_DONE to 0 after calling DQBUF. + +Reported-by: Dimitrios Katsaros +Signed-off-by: Ricardo Ribalda Delgado +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Sasha Levin +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/media/v4l2-core/videobuf2-core.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/media/v4l2-core/videobuf2-core.c ++++ b/drivers/media/v4l2-core/videobuf2-core.c +@@ -2075,6 +2075,11 @@ static int vb2_internal_dqbuf(struct vb2 + dprintk(1, "dqbuf of buffer %d, with state %d\n", + vb->v4l2_buf.index, vb->state); + ++ /* ++ * After calling the VIDIOC_DQBUF V4L2_BUF_FLAG_DONE must be ++ * cleared. ++ */ ++ b->flags &= ~V4L2_BUF_FLAG_DONE; + return 0; + } +