[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221207211040.1099708-4-anthony.l.nguyen@intel.com>
Date: Wed, 7 Dec 2022 13:10:39 -0800
From: Tony Nguyen <anthony.l.nguyen@...el.com>
To: davem@...emloft.net, kuba@...nel.org, pabeni@...hat.com,
edumazet@...gle.com
Cc: Mateusz Palczewski <mateusz.palczewski@...el.com>,
netdev@...r.kernel.org, anthony.l.nguyen@...el.com,
Gurucharan G <gurucharanx.g@...el.com>
Subject: [PATCH net 3/4] ice: Fix deadlock on the rtnl_mutex
From: Mateusz Palczewski <mateusz.palczewski@...el.com>
There is a deadlock on rtnl_mutex when attempting to take the lock
in unregister_netdev() after it has already been taken by
ethnl_set_channels(). This happened when unregister_netdev() was
called inside of ice_vsi_rebuild().
Fix that by removing the unregister_netdev() usage and replace it with
ice_vsi_clear_rings() that deallocates the tx and rx rings for the VSI.
Fixes: df0f847915b4 ("ice: Move common functions out of ice_main.c part 6/7")
Signed-off-by: Mateusz Palczewski <mateusz.palczewski@...el.com>
Tested-by: Gurucharan G <gurucharanx.g@...el.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@...el.com>
---
drivers/net/ethernet/intel/ice/ice_lib.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
index 7276badfa19e..96098c8b5daf 100644
--- a/drivers/net/ethernet/intel/ice/ice_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_lib.c
@@ -3395,12 +3395,10 @@ int ice_vsi_rebuild(struct ice_vsi *vsi, bool init_vsi)
err_vectors:
ice_vsi_free_q_vectors(vsi);
err_rings:
- if (vsi->netdev) {
- vsi->current_netdev_flags = 0;
- unregister_netdev(vsi->netdev);
- free_netdev(vsi->netdev);
- vsi->netdev = NULL;
- }
+ ice_vsi_clear_rings(vsi);
+ set_bit(ICE_RESET_FAILED, pf->state);
+ kfree(coalesce);
+ return ret;
err_vsi:
ice_vsi_clear(vsi);
set_bit(ICE_RESET_FAILED, pf->state);
--
2.35.1
Powered by blists - more mailing lists