OSDN Git Service

net: dcb: disable softirqs in dcbnl_flush_dev()
authorVladimir Oltean <vladimir.oltean@nxp.com>
Wed, 2 Mar 2022 19:39:39 +0000 (21:39 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 3 Mar 2022 16:01:55 +0000 (08:01 -0800)
commit10b6bb62ae1a49ee818fc479cf57b8900176773e
tree805e60ea72baec1086592d580c33cb6b3ee99b99
parent8ccffe9ac3239e549beaa0a9d5e1a1eac94e866c
net: dcb: disable softirqs in dcbnl_flush_dev()

Ido Schimmel points out that since commit 52cff74eef5d ("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: 91b0383fef06 ("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>
net/dcb/dcbnl.c