Skip to content

Commit 10b6bb6

Browse files
vladimirolteankuba-moo
authored andcommitted
net: dcb: disable softirqs in dcbnl_flush_dev()
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 <idosch@idosch.org> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Link: https://lore.kernel.org/r/20220302193939.1368823-1-vladimir.oltean@nxp.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 8ccffe9 commit 10b6bb6

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

net/dcb/dcbnl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2077,7 +2077,7 @@ static void dcbnl_flush_dev(struct net_device *dev)
20772077
{
20782078
struct dcb_app_type *itr, *tmp;
20792079

2080-
spin_lock(&dcb_lock);
2080+
spin_lock_bh(&dcb_lock);
20812081

20822082
list_for_each_entry_safe(itr, tmp, &dcb_app_list, list) {
20832083
if (itr->ifindex == dev->ifindex) {
@@ -2086,7 +2086,7 @@ static void dcbnl_flush_dev(struct net_device *dev)
20862086
}
20872087
}
20882088

2089-
spin_unlock(&dcb_lock);
2089+
spin_unlock_bh(&dcb_lock);
20902090
}
20912091

20922092
static int dcbnl_netdevice_event(struct notifier_block *nb,

0 commit comments

Comments
 (0)