net/rds: ib: don't enable IRQs in rds_ib_conn_free()
Subsystems (5)
PATCH 1/1 net/rds: ib: don't enable IRQs in rds_ib_conn_free()
__rds_conn_create() calls trans->conn_free() with rds_conn_lock held and IRQs disabled when it loses the race to insert a connection. rds_ib_conn_free() takes the device list lock with spin_lock_irq() and releases it with spin_unlock_irq(), so IRQs are turned on while rds_conn_lock is still held:
raw_local_irq_restore() called with IRQs enabled
WARNING: kernel/locking/irqflag-debug.c:10 at warn_bogus_irq_restore+0xc/0x20 _raw_spin_unlock_irqrestore+0x67/0x80 __rds_conn_create+0x1de5/0x2290 rds_conn_create_outgoing+0x43/0x60 rds_sendmsg+0xfca/0x20e0 __sys_sendto+0x408/0x5a0
It needs an RDS socket bound to an address on an RDMA device (e.g. rxe) and two concurrent sendto() calls to the same new destination.
The TCP and loopback ->conn_free() callbacks already use irqsave, so do the same here.
--- net/rds/ib_cm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/rds/ib_cm.c +4 -2
@@ -1271,6 +1271,7 @@ void rds_ib_conn_free(void *arg) {struct rds_ib_connection *ic = arg;spinlock_t *lock_ptr; +unsigned long flags;rdsdebug ("ic %p\n" , ic);
@@ -1281,9 +1282,10 @@ void rds_ib_conn_free(void *arg)*/ lock_ptr = ic->rds_ibdev ? &ic->rds_ibdev->spinlock : &ib_nodev_conns_lock; -spin_lock_irq (lock_ptr); +/* May be called with IRQs already disabled (see __rds_conn_create()) */ +spin_lock_irqsave (lock_ptr, flags);list_del (&ic->ib_node); -spin_unlock_irq (lock_ptr); +spin_unlock_irqrestore (lock_ptr, flags);rds_ib_recv_free_caches (ic);
Signature · 1 line
2.43.0
[email protected]
AI reviewSashiko has reviewed this patch and found no issues.
Quoted 17 lines
__rds_conn_create()callstrans->conn_free()withrds_conn_lockheld and IRQs disabled when it loses the race to insert a connection.rds_ib_conn_free()takes the device list lock withspin_lock_irq()and releases it withspin_unlock_irq(), so IRQs are turned on whilerds_conn_lockis still held:
raw_local_irq_restore()called with IRQs enabledWARNING: kernel/locking/irqflag-debug.c:10 at warn_bogus_irq_restore+0xc/0x20 _raw_spin_unlock_irqrestore+0x67/0x80 __rds_conn_create+0x1de5/0x2290 rds_conn_create_outgoing+0x43/0x60 rds_sendmsg+0xfca/0x20e0 __sys_sendto+0x408/0x5a0It needs an RDS socket bound to an address on an RDMA device (e.g. rxe) and two concurrent
sendto()calls to the same new destination.
Quoted 8 lines
The TCP and loopback ->conn_free() callbacks already use irqsave, so do the same here.
Fixes 745cbccac3fe ("RDS: Rewrite connection cleanup, fixing oops on rmmod")Reported-by [email protected]Signed-off-by Nguyen Ngoc Thang <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 17 lines · Nguyen Ngoc Thang
__rds_conn_create()callstrans->conn_free()withrds_conn_lockheld and IRQs disabled when it loses the race to insert a connection.rds_ib_conn_free()takes the device list lock withspin_lock_irq()and releases it withspin_unlock_irq(), so IRQs are turned on whilerds_conn_lockis still held:
raw_local_irq_restore()called with IRQs enabledWARNING: kernel/locking/irqflag-debug.c:10 at warn_bogus_irq_restore+0xc/0x20 _raw_spin_unlock_irqrestore+0x67/0x80 __rds_conn_create+0x1de5/0x2290 rds_conn_create_outgoing+0x43/0x60 rds_sendmsg+0xfca/0x20e0 __sys_sendto+0x408/0x5a0It needs an RDS socket bound to an address on an RDMA device (e.g. rxe) and two concurrent
sendto()calls to the same new destination.
Quoted 8 lines
The TCP and loopback ->conn_free() callbacks already use irqsave, so do the same here.
Fixes 745cbccac3fe ("RDS: Rewrite connection cleanup, fixing oops on rmmod")Reported-by [email protected]Signed-off-by Nguyen Ngoc Thang <[email protected]>
Hi Nguyen,
Thanks for the fix. This is the same change as patch 1 of the connection-lifetime series pending for net-next ("net/rds: ib: don't enable interrupts in rds_ib_conn_free()"). But that's a much bigger set that's been churning for a while. Since yours is stand alone with the syzbot report for net, it's fine for yours to go first. I'll drop my patch 1 when your patch lands.
Thanks!
Allison
Quoted 29 lines
--- net/rds/ib_cm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)net/rds/ib_cm.c +4
-2@@ -1271,6 +1271,7 @@ void rds_ib_conn_free(void *arg) {struct rds_ib_connection *ic = arg;spinlock_t *lock_ptr; +unsigned long flags;rdsdebug ("ic %p\n" , ic);@@ -1281,9 +1282,10 @@ void rds_ib_conn_free(void *arg)*/ lock_ptr = ic->rds_ibdev ? &ic->rds_ibdev->spinlock : &ib_nodev_conns_lock; -spin_lock_irq (lock_ptr); +/* May be called with IRQs already disabled (see __rds_conn_create()) */ +spin_lock_irqsave (lock_ptr, flags);list_del (&ic->ib_node); -spin_unlock_irq (lock_ptr); +spin_unlock_irqrestore (lock_ptr, flags);rds_ib_recv_free_caches (ic);
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 7 lines · On Fri, 16 Oct 2026 23:15:25 +0700 you wrote:
__rds_conn_create()callstrans->conn_free()withrds_conn_lockheld and IRQs disabled when it loses the race to insert a connection.rds_ib_conn_free()takes the device list lock withspin_lock_irq()and releases it withspin_unlock_irq(), so IRQs are turned on whilerds_conn_lockis still held:
raw_local_irq_restore()called with IRQs enabled
Quoted 8 lines
WARNING: kernel/locking/irqflag-debug.c:10 at warn_bogus_irq_restore+0xc/0x20 _raw_spin_unlock_irqrestore+0x67/0x80 __rds_conn_create+0x1de5/0x2290 rds_conn_create_outgoing+0x43/0x60 rds_sendmsg+0xfca/0x20e0 __sys_sendto+0x408/0x5a0[...]
Here is the summary with links:
- net/rds: ib: don't enable IRQs in rds_ib_conn_free()
https://git.kernel.org/netdev/net-next/c/f6fa1d60ec3c
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html