]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.14-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Jul 2023 07:00:15 +0000 (09:00 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Jul 2023 07:00:15 +0000 (09:00 +0200)
added patches:
misc-pci_endpoint_test-re-init-completion-for-every-test.patch

queue-4.14/misc-pci_endpoint_test-re-init-completion-for-every-test.patch [new file with mode: 0644]
queue-4.14/series

diff --git a/queue-4.14/misc-pci_endpoint_test-re-init-completion-for-every-test.patch b/queue-4.14/misc-pci_endpoint_test-re-init-completion-for-every-test.patch
new file mode 100644 (file)
index 0000000..6e79889
--- /dev/null
@@ -0,0 +1,44 @@
+From fb620ae73b70c2f57b9d3e911fc24c024ba2324f Mon Sep 17 00:00:00 2001
+From: Damien Le Moal <dlemoal@kernel.org>
+Date: Sat, 15 Apr 2023 11:35:40 +0900
+Subject: misc: pci_endpoint_test: Re-init completion for every test
+
+From: Damien Le Moal <dlemoal@kernel.org>
+
+commit fb620ae73b70c2f57b9d3e911fc24c024ba2324f upstream.
+
+The irq_raised completion used to detect the end of a test case is
+initialized when the test device is probed, but never reinitialized again
+before a test case. As a result, the irq_raised completion synchronization
+is effective only for the first ioctl test case executed. Any subsequent
+call to wait_for_completion() by another ioctl() call will immediately
+return, potentially too early, leading to false positive failures.
+
+Fix this by reinitializing the irq_raised completion before starting a new
+ioctl() test command.
+
+Link: https://lore.kernel.org/r/20230415023542.77601-16-dlemoal@kernel.org
+Fixes: 2c156ac71c6b ("misc: Add host side PCI driver for PCI test function device")
+Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
+Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
+Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
+Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/misc/pci_endpoint_test.c |    4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/drivers/misc/pci_endpoint_test.c
++++ b/drivers/misc/pci_endpoint_test.c
+@@ -425,6 +425,10 @@ static long pci_endpoint_test_ioctl(stru
+       struct pci_endpoint_test *test = to_endpoint_test(file->private_data);
+       mutex_lock(&test->mutex);
++
++      reinit_completion(&test->irq_raised);
++      test->last_irq = -ENODATA;
++
+       switch (cmd) {
+       case PCITEST_BAR:
+               bar = arg;
index 6a3e7fdc7fa14a9d014d0901953af7968009b63d..276aff67986fc21ae6ce2ebd69bc6487059a78ad 100644 (file)
@@ -107,3 +107,4 @@ ext4-fix-to-check-return-value-of-freeze_bdev-in-ext4_shutdown.patch
 ext4-only-update-i_reserved_data_blocks-on-successful-block-allocation.patch
 jfs-jfs_dmap-validate-db_l2nbperpage-while-mounting.patch
 pci-add-function-1-dma-alias-quirk-for-marvell-88se9235.patch
+misc-pci_endpoint_test-re-init-completion-for-every-test.patch