Re: [PATCH net] net: mana: fix reset work race with device removal
[email protected] Thu, 06 Aug 2026 14:20:54 +0000
| Newsgroups | org.kernel.vger.linux-hyperv |
|---|---|
| Message-ID | <[email protected]> |
Thank you for your contribution! Sashiko AI review found 1 potential issue(= s) to consider: - [Medium] Clearing GC_IN_SERVICE before a PCI rescan allows a redundant 10= -second reset cycle to race with device teardown. -- --- Patch [1]: [PATCH net] net: mana: fix reset work race with device remov= al --- commit 09d0d942fe66b8d000decbfd0fc00c78cb2cea3c Author: Fan Wu <[email protected]> net: mana: fix reset work race with device removal This commit serializes the reset service work with device removal by holding the PCI device lock. It ensures the GDMA context is not freed while a reset is in progress. The lock is dropped before rescanning the PCI bus or when t= he reset completes. > diff --git a/drivers/net/ethernet/microsoft/mana/gdma_main.c b/drivers/ne= t/ethernet/microsoft/mana/gdma_main.c > --- a/drivers/net/ethernet/microsoft/mana/gdma_main.c > +++ b/drivers/net/ethernet/microsoft/mana/gdma_main.c [ ... ] > @@ -621,8 +622,8 @@ static void mana_serv_reset(struct pci_dev *pdev) > if (ret =3D=3D -ETIMEDOUT || ret =3D=3D -EPROTO) { > /* Perform PCI rescan on device if we failed on HWC */ > dev_err(&pdev->dev, "MANA service: resume failed, rescanning\n"); > - mana_serv_rescan(pdev); > - return; > + clear_bit(GC_IN_SERVICE, &gc->flags); > + goto rescan; [Severity: Medium] If mana_gd_resume() fails, the driver clears GC_IN_SERVICE and releases the device lock before calling pci_stop_and_remove_bus_device() via mana_serv_rescan(). If the hardware repeatedly asserts errors and issues another reset request during this window, mana_schedule_serv_work() could queue a new reset work. That new work would immediately grab the device lock, observe a non-NULL gc, and sleep for 10 seconds. This could block the PCI core from completing the device teardown, as it requires the device lock to invoke the remove callba= ck. Does clearing GC_IN_SERVICE here before the PCI rescan open a race window that delays device teardown? > } > =20 > if (ret) [ ... ] --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20260805141937.2171= [email protected]?part=3D1