Skip to content

Commit

Permalink
net: dcb: disable softirqs in dcbnl_flush_dev()
Browse files Browse the repository at this point in the history
Ido Schimmel points out that since commit 52cff74 ("dcbnl : Disable
software interrupts before taking dcb_lock"), the DCB API can be called
by drivers from softirq context.

One such in-tree example is the chelsio cxgb4 driver:
dcb_rpl
-> cxgb4_dcb_handle_fw_update
   -> dcb_ieee_setapp

If the firmware for this driver happened to send an event which resulted
in a call to dcb_ieee_setapp() at the exact same time as another
DCB-enabled interface was unregistering on the same CPU, the softirq
would deadlock, because the interrupted process was already holding the
dcb_lock in dcbnl_flush_dev().

Fix this unlikely event by using spin_lock_bh() in dcbnl_flush_dev() as
in the rest of the dcbnl code.

Fixes: 91b0383 ("net: dcb: flush lingering app table entries for unregistered devices")
Reported-by: Ido Schimmel <[email protected]>
Signed-off-by: Vladimir Oltean <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
vladimiroltean authored and kuba-moo committed Mar 3, 2022
1 parent 8ccffe9 commit 10b6bb6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/dcb/dcbnl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2077,7 +2077,7 @@ static void dcbnl_flush_dev(struct net_device *dev)
{
struct dcb_app_type *itr, *tmp;

spin_lock(&dcb_lock);
spin_lock_bh(&dcb_lock);

list_for_each_entry_safe(itr, tmp, &dcb_app_list, list) {
if (itr->ifindex == dev->ifindex) {
Expand All @@ -2086,7 +2086,7 @@ static void dcbnl_flush_dev(struct net_device *dev)
}
}

spin_unlock(&dcb_lock);
spin_unlock_bh(&dcb_lock);
}

static int dcbnl_netdevice_event(struct notifier_block *nb,
Expand Down

0 comments on commit 10b6bb6

Please sign in to comment.