Skip to content

Commit d09e269

Browse files
dmertmanJeff Kirsher
authored andcommitted
ice: Avoid nested RTNL locking in ice_dis_vsi
ice_dis_vsi() performs an rtnl_lock() if it detects a netdev that is running on the VSI. In cases where the RTNL lock has already been acquired, a deadlock results. Add a boolean to pass to ice_dis_vsi to tell it if the RTNL lock is already held. Signed-off-by: Dave Ertman <[email protected]> Signed-off-by: Anirudh Venkataramanan <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 995c90f commit d09e269

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

drivers/net/ethernet/intel/ice/ice_main.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3137,8 +3137,9 @@ static void ice_vsi_release_all(struct ice_pf *pf)
31373137
/**
31383138
* ice_dis_vsi - pause a VSI
31393139
* @vsi: the VSI being paused
3140+
* @locked: is the rtnl_lock already held
31403141
*/
3141-
static void ice_dis_vsi(struct ice_vsi *vsi)
3142+
static void ice_dis_vsi(struct ice_vsi *vsi, bool locked)
31423143
{
31433144
if (test_bit(__ICE_DOWN, vsi->state))
31443145
return;
@@ -3147,9 +3148,13 @@ static void ice_dis_vsi(struct ice_vsi *vsi)
31473148

31483149
if (vsi->type == ICE_VSI_PF && vsi->netdev) {
31493150
if (netif_running(vsi->netdev)) {
3150-
rtnl_lock();
3151-
vsi->netdev->netdev_ops->ndo_stop(vsi->netdev);
3152-
rtnl_unlock();
3151+
if (!locked) {
3152+
rtnl_lock();
3153+
vsi->netdev->netdev_ops->ndo_stop(vsi->netdev);
3154+
rtnl_unlock();
3155+
} else {
3156+
vsi->netdev->netdev_ops->ndo_stop(vsi->netdev);
3157+
}
31533158
} else {
31543159
ice_vsi_close(vsi);
31553160
}
@@ -3188,7 +3193,7 @@ static void ice_pf_dis_all_vsi(struct ice_pf *pf)
31883193

31893194
ice_for_each_vsi(pf, v)
31903195
if (pf->vsi[v])
3191-
ice_dis_vsi(pf->vsi[v]);
3196+
ice_dis_vsi(pf->vsi[v], false);
31923197
}
31933198

31943199
/**

0 commit comments

Comments
 (0)