> -----Original Message-----
> From: Intel-wired-lan <[email protected]> On Behalf Of 
> Maciej Fijalkowski
> Sent: Wednesday, July 1, 2026 5:45 AM
> To: [email protected]
> Cc: [email protected]; Karlsson, Magnus <[email protected]>; 
> [email protected]; [email protected]; [email protected]; Kitszel, Przemyslaw 
> <[email protected]>; Keller, Jacob E >  
> <[email protected]>; Fijalkowski, Maciej 
> <[email protected]>; Sashiko AI Review <[email protected]>
> Subject: [Intel-wired-lan] [PATCH v5 net 4/7] i40e: avoid deadlock when 
> calling unregister_netdev()
>
> Sashiko reports:
> ***
> > +err_netdev:
> >     if (vsi->netdev_registered) {
> >             vsi->netdev_registered = false;
> >             unregister_netdev(vsi->netdev);
> Could this result in a deadlock when called during a device rebuild?
> Looking at i40e_rebuild(), it explicitly acquires the RTNL lock before
> proceeding:
> drivers/net/ethernet/intel/i40e/i40e_main.c:i40e_rebuild() {
>    ...
>       if (!lock_acquired)
>               rtnl_lock();
>       ret = i40e_setup_pf_switch(pf, reinit, true);
>     ...
> }
> If i40e_setup_pf_switch() calls i40e_vsi_reinit_setup() and takes this new
> err_netdev path, unregister_netdev() will unconditionally attempt to acquire
> rtnl_lock(), leading to a deadlock on the non-recursive mutex.
> ***
>
> Use unregister_netdevice() when the rebuild path already holds RTNL, and
> keep unregister_netdev() for callers that do not. This avoids both
> recursive RTNL locking and dropping RTNL in the middle of the VSI unwind
> path.
>
> Fixes: bc7d338fbb3f ("i40e: reinit flow for the main VSI")
> Reported-by: Sashiko AI Review <[email protected]>
> Signed-off-by: Maciej Fijalkowski <[email protected]>
> ---
>  drivers/net/ethernet/intel/i40e/i40e_main.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)

Tested-by: Sunitha Mekala <[email protected]> (A Contingent worker at 
Intel)

Reply via email to