]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
PCI: epf-test: Fix DMA transfer completion initialization
authorDamien Le Moal <dlemoal@kernel.org>
Sat, 15 Apr 2023 02:35:28 +0000 (11:35 +0900)
committerRoxana Nicolescu <roxana.nicolescu@canonical.com>
Mon, 2 Oct 2023 15:20:18 +0000 (17:20 +0200)
BugLink: https://bugs.launchpad.net/bugs/2036075
commit 4aca56f8eae8aa44867ddd6aa107e06f7613226f upstream.

Reinitialize the transfer_complete DMA transfer completion before calling
tx_submit(), to avoid seeing the DMA transfer complete before the
completion is initialized, thus potentially losing the completion
notification.

Link: https://lore.kernel.org/r/20230415023542.77601-4-dlemoal@kernel.org
Fixes: 8353813c88ef ("PCI: endpoint: Enable DMA tests for endpoints with DMA capabilities")
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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/pci/endpoint/functions/pci-epf-test.c

index f0c4d0f77453a352e52ca5f26cdc30a02c49d0dd..bf12354b18d574ede3eccdff46afbe207ae61d99 100644 (file)
@@ -151,10 +151,10 @@ static int pci_epf_test_data_transfer(struct pci_epf_test *epf_test,
                return -EIO;
        }
 
+       reinit_completion(&epf_test->transfer_complete);
        tx->callback = pci_epf_test_dma_callback;
        tx->callback_param = epf_test;
        cookie = tx->tx_submit(tx);
-       reinit_completion(&epf_test->transfer_complete);
 
        ret = dma_submit_error(cookie);
        if (ret) {