Skip to content

Commit 71f5409

Browse files
dhowellskuba-moo
authored andcommitted
rxrpc: Fix locking issues with the peer record hash
rxrpc_new_incoming_peer() can't use spin_lock_bh() whilst its caller has interrupts disabled. WARNING: CPU: 0 PID: 1550 at kernel/softirq.c:369 __local_bh_enable_ip+0x46/0xd0 ... Call Trace: rxrpc_alloc_incoming_call+0x1b0/0x400 rxrpc_new_incoming_call+0x1dd/0x5e0 rxrpc_input_packet+0x84a/0x920 rxrpc_io_thread+0x40d/0xb40 kthread+0x2ec/0x300 ret_from_fork+0x24/0x40 ret_from_fork_asm+0x1a/0x30 </TASK> irq event stamp: 1811 hardirqs last enabled at (1809): _raw_spin_unlock_irq+0x24/0x50 hardirqs last disabled at (1810): _raw_read_lock_irq+0x17/0x70 softirqs last enabled at (1182): handle_softirqs+0x3ee/0x430 softirqs last disabled at (1811): rxrpc_new_incoming_peer+0x56/0x120 Fix this by using a plain spin_lock() instead. IRQs are held, so softirqs can't happen. Fixes: a2ea9a9 ("rxrpc: Use irq-disabling spinlocks between app and I/O thread") Signed-off-by: David Howells <[email protected]> cc: Marc Dionne <[email protected]> cc: Simon Horman <[email protected]> cc: [email protected] Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 833fefa commit 71f5409

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/rxrpc/peer_object.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,10 +324,10 @@ void rxrpc_new_incoming_peer(struct rxrpc_local *local, struct rxrpc_peer *peer)
324324
hash_key = rxrpc_peer_hash_key(local, &peer->srx);
325325
rxrpc_init_peer(local, peer, hash_key);
326326

327-
spin_lock_bh(&rxnet->peer_hash_lock);
327+
spin_lock(&rxnet->peer_hash_lock);
328328
hash_add_rcu(rxnet->peer_hash, &peer->hash_link, hash_key);
329329
list_add_tail(&peer->keepalive_link, &rxnet->peer_keepalive_new);
330-
spin_unlock_bh(&rxnet->peer_hash_lock);
330+
spin_unlock(&rxnet->peer_hash_lock);
331331
}
332332

333333
/*

0 commit comments

Comments
 (0)