Commit cecc155
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: stable@vger.kernel.org
Fixes: 86e25f4 ("net: napi: Add napi_config")
Reported-by: Guenter Roeck <linux@roeck-us.net>
Closes: https://lore.kernel.org/netdev/85dd4590-ea6b-427d-876a-1d8559c7ad82@roeck-us.net/
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Joe Damato <jdamato@fastly.com>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20241202182103.363038-1-jdamato@fastly.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>1 parent af8edae commit cecc155
1 file changed
Lines changed: 12 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6557 | 6557 | | |
6558 | 6558 | | |
6559 | 6559 | | |
6560 | | - | |
| 6560 | + | |
| 6561 | + | |
| 6562 | + | |
6561 | 6563 | | |
6562 | 6564 | | |
6563 | | - | |
| 6565 | + | |
6564 | 6566 | | |
6565 | 6567 | | |
6566 | 6568 | | |
6567 | 6569 | | |
| 6570 | + | |
| 6571 | + | |
6568 | 6572 | | |
6569 | 6573 | | |
6570 | 6574 | | |
6571 | | - | |
| 6575 | + | |
6572 | 6576 | | |
6573 | 6577 | | |
6574 | 6578 | | |
| |||
6578 | 6582 | | |
6579 | 6583 | | |
6580 | 6584 | | |
6581 | | - | |
| 6585 | + | |
6582 | 6586 | | |
6583 | 6587 | | |
6584 | 6588 | | |
6585 | 6589 | | |
6586 | 6590 | | |
6587 | 6591 | | |
6588 | 6592 | | |
6589 | | - | |
| 6593 | + | |
| 6594 | + | |
| 6595 | + | |
6590 | 6596 | | |
6591 | 6597 | | |
6592 | 6598 | | |
6593 | | - | |
| 6599 | + | |
6594 | 6600 | | |
6595 | 6601 | | |
6596 | 6602 | | |
| |||
0 commit comments