RE: [EXTERNAL] [PATCH net] net: mana: fix reset work race with device removal
Haiyang Zhang <[email protected]> Thu, 6 Aug 2026 14:17:31 +0000
| Newsgroups | org.kernel.vger.linux-hyperv,org.kernel.vger.linux-kernel,org.kernel.vger.netdev,org.kernel.vger.stable |
|---|---|
| Message-ID | <LV5PR21MB470447ECF9B18154AE2F2D66CAD22@LV5PR21MB4704.namprd21.prod.outlook.com> |
> -----Original Message----- > From: Fan Wu <[email protected]> > Sent: Wednesday, August 5, 2026 10:38 AM > To: [email protected] > Cc: KY Srinivasan <[email protected]>; Haiyang Zhang > <[email protected]>; Wei Liu <[email protected]>; Dexuan Cui > <[email protected]>; Long Li <[email protected]>; Andrew Lunn > <[email protected]>; David S . Miller <[email protected]>; Eric > Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo > Abeni <[email protected]>; [email protected]; linux- > [email protected]; [email protected] > Subject: [EXTERNAL] [PATCH net] net: mana: fix reset work race with devic= e > removal >=20 > [Some people who received this message don't often get email from > [email protected]. Learn why this is important at > https://aka.ms/LearnAboutSenderIdentification ] >=20 > The reset service work runs on the system workqueue and obtains the > GDMA context through PCI drvdata. It can race with device removal > (mana_gd_remove()), which frees the context. A reset work that runs > after removal can therefore dereference the freed context. >=20 > Serialize mana_serv_reset() with device removal by taking the PCI > device lock across its drvdata access and reset sequence. The driver > core holds the same lock while invoking the remove callback, so remove > waits for an in-progress reset. Work that runs after remove observes > the drvdata cleared before the context is freed. >=20 > Drop the lock before rescanning, since the rescan path may remove the > device and acquire the device lock again. Also clear GC_IN_SERVICE > before rescanning after a failed resume, so this exit follows the same > service-state cleanup as the other reset exits. >=20 > This issue was found by an in-house static analysis tool. >=20 > Fixes: fbe346ce9d62 ("net: mana: Handle Reset Request from MANA NIC") > Cc: [email protected] > Assisted-by: Codex:gpt-5.6 > Signed-off-by: Fan Wu <[email protected]> > --- > drivers/net/ethernet/microsoft/mana/gdma_main.c | 18 +++++++++++++----- > 1 file changed, 13 insertions(+), 5 deletions(-) Adding some of my teammates: @Dipayaan Roy @Sahil Chandna - Haiyang