RE: [EXTERNAL] [PATCH net] net: mana: fix reset work race with device removal

From: Haiyang Zhang

Date: Thu Aug 06 2026 - 10:21:20 EST




> -----Original Message-----
> From: Fan Wu <fanwu01@xxxxxxxxxx>
> Sent: Wednesday, August 5, 2026 10:38 AM
> To: netdev@xxxxxxxxxxxxxxx
> Cc: KY Srinivasan <kys@xxxxxxxxxxxxx>; Haiyang Zhang
> <haiyangz@xxxxxxxxxxxxx>; Wei Liu <wei.liu@xxxxxxxxxx>; Dexuan Cui
> <DECUI@xxxxxxxxxxxxx>; Long Li <longli@xxxxxxxxxxxxx>; Andrew Lunn
> <andrew+netdev@xxxxxxx>; David S . Miller <davem@xxxxxxxxxxxxx>; Eric
> Dumazet <edumazet@xxxxxxxxxx>; Jakub Kicinski <kuba@xxxxxxxxxx>; Paolo
> Abeni <pabeni@xxxxxxxxxx>; linux-hyperv@xxxxxxxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx; stable@xxxxxxxxxxxxxxx
> Subject: [EXTERNAL] [PATCH net] net: mana: fix reset work race with device
> removal
>
> [Some people who received this message don't often get email from
> fanwu01@xxxxxxxxxx. Learn why this is important at
> https://aka.ms/LearnAboutSenderIdentification ]
>
> 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.
>
> 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.
>
> 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.
>
> This issue was found by an in-house static analysis tool.
>
> Fixes: fbe346ce9d62 ("net: mana: Handle Reset Request from MANA NIC")
> Cc: stable@xxxxxxxxxxxxxxx
> Assisted-by: Codex:gpt-5.6
> Signed-off-by: Fan Wu <fanwu01@xxxxxxxxxx>
> ---
> 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