]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.18-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 3 Apr 2018 17:46:20 +0000 (19:46 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 3 Apr 2018 17:46:20 +0000 (19:46 +0200)
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

queue-3.18/media-v4l2-ioctl.c-don-t-copy-back-the-result-for-enotty.patch [new file with mode: 0644]
queue-3.18/series
queue-3.18/vb2-v4l2_buf_flag_done-is-set-after-dqbuf.patch [new file with mode: 0644]

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 (file)
index 0000000..7f77480
--- /dev/null
@@ -0,0 +1,38 @@
+From 181a4a2d5a0a7b43cab08a70710d727e7764ccdd Mon Sep 17 00:00:00 2001
+From: Hans Verkuil <hans.verkuil@cisco.com>
+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 <hans.verkuil@cisco.com>
+
+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 <hans.verkuil@cisco.com>
+Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
+Cc: <stable@vger.kernel.org>      # for v4.15 and up
+Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
+Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ 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);
index e056ffd280ce0da82df8809ac973a8a2c5f77480..1f8be5947bf30c967fb9e302c7a80a0866e7f69f 100644 (file)
@@ -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 (file)
index 0000000..6aebf6b
--- /dev/null
@@ -0,0 +1,50 @@
+From 3171cc2b4eb9831ab4df1d80d0410a945b8bc84e Mon Sep 17 00:00:00 2001
+From: Ricardo Ribalda <ricardo.ribalda@gmail.com>
+Date: Mon, 20 Jun 2016 09:47:22 -0300
+Subject: [media] vb2: V4L2_BUF_FLAG_DONE is set after DQBUF
+
+From: Ricardo Ribalda <ricardo.ribalda@gmail.com>
+
+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 <patcherwork@gmail.com>
+Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
+Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
+Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
+Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
+Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ 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;
+ }