]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Aug 2021 13:20:11 +0000 (15:20 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Aug 2021 13:20:11 +0000 (15:20 +0200)
added patches:
media-v4l2-mem2mem-always-consider-output-queue-during-poll.patch

queue-5.4/media-v4l2-mem2mem-always-consider-output-queue-during-poll.patch [new file with mode: 0644]
queue-5.4/series

diff --git a/queue-5.4/media-v4l2-mem2mem-always-consider-output-queue-during-poll.patch b/queue-5.4/media-v4l2-mem2mem-always-consider-output-queue-during-poll.patch
new file mode 100644 (file)
index 0000000..ea11241
--- /dev/null
@@ -0,0 +1,44 @@
+From 566463afdbc43c7744c5a1b89250fc808df03833 Mon Sep 17 00:00:00 2001
+From: Alexandre Courbot <gnurou@gmail.com>
+Date: Thu, 27 Aug 2020 14:49:45 +0200
+Subject: media: v4l2-mem2mem: always consider OUTPUT queue during poll
+
+From: Alexandre Courbot <gnurou@gmail.com>
+
+commit 566463afdbc43c7744c5a1b89250fc808df03833 upstream.
+
+If poll() is called on a m2m device with the EPOLLOUT event after the
+last buffer of the CAPTURE queue is dequeued, any buffer available on
+OUTPUT queue will never be signaled because v4l2_m2m_poll_for_data()
+starts by checking whether dst_q->last_buffer_dequeued is set and
+returns EPOLLIN in this case, without looking at the state of the OUTPUT
+queue.
+
+Fix this by not early returning so we keep checking the state of the
+OUTPUT queue afterwards.
+
+Signed-off-by: Alexandre Courbot <gnurou@gmail.com>
+Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com>
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
+Cc: Lecopzer Chen <lecopzer.chen@mediatek.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/media/v4l2-core/v4l2-mem2mem.c |    6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+--- a/drivers/media/v4l2-core/v4l2-mem2mem.c
++++ b/drivers/media/v4l2-core/v4l2-mem2mem.c
+@@ -635,10 +635,8 @@ static __poll_t v4l2_m2m_poll_for_data(s
+                * If the last buffer was dequeued from the capture queue,
+                * return immediately. DQBUF will return -EPIPE.
+                */
+-              if (dst_q->last_buffer_dequeued) {
+-                      spin_unlock_irqrestore(&dst_q->done_lock, flags);
+-                      return EPOLLIN | EPOLLRDNORM;
+-              }
++              if (dst_q->last_buffer_dequeued)
++                      rc |= EPOLLIN | EPOLLRDNORM;
+       }
+       spin_unlock_irqrestore(&dst_q->done_lock, flags);
index abf81961e66ed09ca581a6e19206cfe66539163d..42173c2be131f3bd74644163a3bf17b84a8dd1a1 100644 (file)
@@ -1,3 +1,4 @@
 kvm-svm-fix-off-by-one-indexing-when-nullifying-last.patch
 tee-correct-inappropriate-usage-of-tee_shm_dma_buf-f.patch
 usb-dwc3-gadget-use-list_replace_init-before-travers.patch
+media-v4l2-mem2mem-always-consider-output-queue-during-poll.patch