cnic: Fix rtnl deadlock
Subsystems (2)
PATCH 1/1 cnic: Fix rtnl deadlock
When cnic_stop_hw() -> cnic_cm_stop_bnx2x_hw() is called under rtnl_lock() from NETDEV_DOWN event, it waits for cnic_delete_task() to complete. It will deadlock when cnic_delete_task() takes rtnl_lock() before calling cnic_ulp_stop_one().
We fix it by removing the rtnl_lock() in cnic_delete_task(). cnic_ulp_stop_one() has mutex and atomic bit ops to prevent important operations from being done more than once, so it is not necessary to take rtnl_lock().
--- drivers/net/cnic.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
drivers/net/cnic.c +0 -2
@@ -3983,9 +3983,7 @@ static void cnic_delete_task(struct work_struct *work)if (test_and_clear_bit (CNIC_LCL_FL_STOP_ISCSI , &cp->cnic_local_flags)) {struct drv_ctl_info info; -rtnl_lock ();cnic_ulp_stop_one (cp,CNIC_ULP_ISCSI ); -rtnl_unlock (); info.cmd =DRV_CTL_ISCSI_STOPPED_CMD ; cp->ethdev->drv_ctl (dev->netdev, &info);
Signature · 1 line
1.6.4.GIT
From: "Michael Chan" <[email protected]>
Date: Fri, 8 Apr 2011 10:44:14 -0700
Quoted 11 lines
When
cnic_stop_hw()->cnic_cm_stop_bnx2x_hw()is called underrtnl_lock()fromNETDEV_DOWNevent, it waits forcnic_delete_task()to complete. It will deadlock whencnic_delete_task()takesrtnl_lock()before callingcnic_ulp_stop_one().We fix it by removing the
rtnl_lock()incnic_delete_task().cnic_ulp_stop_one()has mutex and atomic bit ops to prevent important operations from being done more than once, so it is not necessary to takertnl_lock().Signed-off-by Michael Chan <[email protected]>
Applied, thanks Michael.