[Intel-wired-lan] [PATCH v2] igb: revert rtnl_lock() that causes deadlock

Romanowski, Rafal rafal.romanowski at intel.com
Thu Mar 16 09:10:43 UTC 2023


> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces at osuosl.org> On Behalf Of
> Lin Ma
> Sent: wtorek, 7 marca 2023 16:29
> To: Brandeburg, Jesse <jesse.brandeburg at intel.com>; Nguyen, Anthony L
> <anthony.l.nguyen at intel.com>; davem at davemloft.net;
> edumazet at google.com; kuba at kernel.org; pabeni at redhat.com;
> netdev at vger.kernel.org; linux-kernel at vger.kernel.org;
> richardcochran at gmail.com; ast at kernel.org; daniel at iogearbox.net;
> hawk at kernel.org; john.fastabend at gmail.com
> Cc: pmenzel at molgen.mpg.de; Vinschen, Corinna <vinschen at redhat.com>;
> regressions at lists.linux.dev; stable at vger.kernel.org; intel-wired-
> lan at lists.osuosl.org; Lin Ma <linma at zju.edu.cn>
> Subject: [Intel-wired-lan] [PATCH v2] igb: revert rtnl_lock() that causes
> deadlock
> 
> The commit 6faee3d4ee8b ("igb: Add lock to avoid data race") adds rtnl_lock
> to eliminate a false data race shown below
> 
>  (FREE from device detaching)      |   (USE from netdev core)
> igb_remove                         |  igb_ndo_get_vf_config
>  igb_disable_sriov                 |  vf >= adapter->vfs_allocated_count?
>   kfree(adapter->vf_data)          |
>   adapter->vfs_allocated_count = 0 |
>                                    |    memcpy(... adapter->vf_data[vf]
> 
> The above race will never happen and the extra rtnl_lock causes deadlock
> below
> diff --git a/drivers/net/ethernet/intel/igb/igb_main.c
> b/drivers/net/ethernet/intel/igb/igb_main.c
> index 03bc1e8af575..5532361b0e94 100644
> --- a/drivers/net/ethernet/intel/igb/igb_main.c
> +++ b/drivers/net/ethernet/intel/igb/igb_main.c
> @@ -3863,9 +3863,7 @@ static void igb_remove(struct pci_dev *pdev)
>  	igb_release_hw_control(adapter);
> 
>  #ifdef CONFIG_PCI_IOV
> -	rtnl_lock();
>  	igb_disable_sriov(pdev);
> -	rtnl_unlock();
>  #endif
> 
>  	unregister_netdev(netdev);
> --


Tested-by: Rafal Romanowski <rafal.romanowski at intel.com>





More information about the Intel-wired-lan mailing list