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

Haiyang Zhang <[email protected]>
Newsgroups org.kernel.vger.stable,org.kernel.vger.linux-hyperv,org.kernel.vger.linux-kernel,org.kernel.vger.netdev
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 device
> removal
> 
> [Some people who received this message don't often get email from
> [email protected]. 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: [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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.