Skip to content

Commit f61b763

Browse files
damien-lemoalbjorn-helgaas
authored andcommitted
misc: pci_endpoint_test: Free IRQs before removing the device
In pci_endpoint_test_remove(), freeing the IRQs after removing the device creates a small race window for IRQs to be received with the test device memory already released, causing the IRQ handler to access invalid memory, resulting in an oops. Free the device IRQs before removing the device to avoid this issue. Link: https://lore.kernel.org/r/[email protected] Fixes: e033271 ("pci_endpoint_test: Add 2 ioctl commands") Signed-off-by: Damien Le Moal <[email protected]> Signed-off-by: Lorenzo Pieralisi <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Cc: [email protected]
1 parent 1754dfd commit f61b763

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/misc/pci_endpoint_test.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -938,6 +938,9 @@ static void pci_endpoint_test_remove(struct pci_dev *pdev)
938938
if (id < 0)
939939
return;
940940

941+
pci_endpoint_test_release_irq(test);
942+
pci_endpoint_test_free_irq_vectors(test);
943+
941944
misc_deregister(&test->miscdev);
942945
kfree(misc_device->name);
943946
kfree(test->name);
@@ -947,9 +950,6 @@ static void pci_endpoint_test_remove(struct pci_dev *pdev)
947950
pci_iounmap(pdev, test->bar[bar]);
948951
}
949952

950-
pci_endpoint_test_release_irq(test);
951-
pci_endpoint_test_free_irq_vectors(test);
952-
953953
pci_release_regions(pdev);
954954
pci_disable_device(pdev);
955955
}

0 commit comments

Comments
 (0)