Skip to content

Commit 8b926f2

Browse files
computersforpeacebjorn-helgaas
authored andcommitted
PCI/pwrctrl: Cancel outstanding rescan work when unregistering
It's possible to trigger use-after-free here by: (a) forcing rescan_work_func() to take a long time and (b) utilizing a pwrctrl driver that may be unloaded for some reason Cancel outstanding work to ensure it is finished before we allow our data structures to be cleaned up. [bhelgaas: tidy commit log] Fixes: 8f62819 ("PCI/pwrctl: Rescan bus on a separate thread") Signed-off-by: Brian Norris <[email protected]> Signed-off-by: Brian Norris <[email protected]> Signed-off-by: Krzysztof Wilczyński <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Acked-by: Bartosz Golaszewski <[email protected]> Cc: Konrad Dybcio <[email protected]> Link: https://patch.msgid.link/20250409115313.1.Ia319526ed4ef06bec3180378c9a008340cec9658@changeid
1 parent 0af2f6b commit 8b926f2

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/pci/pwrctrl/core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ EXPORT_SYMBOL_GPL(pci_pwrctrl_device_set_ready);
101101
*/
102102
void pci_pwrctrl_device_unset_ready(struct pci_pwrctrl *pwrctrl)
103103
{
104+
cancel_work_sync(&pwrctrl->work);
105+
104106
/*
105107
* We don't have to delete the link here. Typically, this function
106108
* is only called when the power control device is being detached. If

0 commit comments

Comments
 (0)