diff options
author | Joe Damato <[email protected]> | 2024-12-02 18:21:02 +0000 |
---|---|---|
committer | Jakub Kicinski <[email protected]> | 2024-12-03 18:25:33 -0800 |
commit | cecc1555a8c2acd65f9d36182c28ae463db0ad7e (patch) | |
tree | 930ffda825e12b5226112ff39232f63f7e22bec0 /drivers/fpga/fpga-mgr.c | |
parent | af8edaeddbc52e53207d859c912b017fd9a77629 (diff) |
net: Make napi_hash_lock irq safe
Make napi_hash_lock IRQ safe. It is used during the control path, and is
taken and released in napi_hash_add and napi_hash_del, which will
typically be called by calls to napi_enable and napi_disable.
This change avoids a deadlock in pcnet32 (and other any other drivers
which follow the same pattern):
CPU 0:
pcnet32_open
spin_lock_irqsave(&lp->lock, ...)
napi_enable
napi_hash_add <- before this executes, CPU 1 proceeds
spin_lock(napi_hash_lock)
[...]
spin_unlock_irqrestore(&lp->lock, flags);
CPU 1:
pcnet32_close
napi_disable
napi_hash_del
spin_lock(napi_hash_lock)
< INTERRUPT >
pcnet32_interrupt
spin_lock(lp->lock) <- DEADLOCK
Changing the napi_hash_lock to be IRQ safe prevents the IRQ from firing
on CPU 1 until napi_hash_lock is released, preventing the deadlock.
Cc: [email protected]
Fixes: 86e25f40aa1e ("net: napi: Add napi_config")
Reported-by: Guenter Roeck <[email protected]>
Closes: https://lore.kernel.org/netdev/[email protected]/
Suggested-by: Jakub Kicinski <[email protected]>
Signed-off-by: Joe Damato <[email protected]>
Tested-by: Guenter Roeck <[email protected]>
Reviewed-by: Eric Dumazet <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'drivers/fpga/fpga-mgr.c')
0 files changed, 0 insertions, 0 deletions