Re: [PATCH] PCI: switchtec: Fix use-after-free in switchtec_pci_remove due to race condition
Logan Gunthorpe <[email protected]> Wed, 5 Aug 2026 10:05:25 -0600
| Newsgroups | org.kernel.vger.linux-pci,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On 2026-08-04 19:28, Pei Xiao wrote: >> I'm wondering if these should come before the mrpc_timeout sync. >> Otherwise, hypothetically, new work could be added and another timeout >> could be in progress. >> > yes, > > + cancel_work_sync(&stdev->mrpc_work); > + cancel_work_sync(&stdev->link_event_work); > cancel_delayed_work_sync(&stdev->mrpc_timeout); > >> Also, I'm not sure, but seems like the interrupt should be disabled >> before this as well? > I looked it up and it appears that pci_clear_master cannot disable > interrupt enabling. Should I use devm_free_irq? Yes, I believe a couple calls to devm_free_irq() is what will be needed here. Logan