rxrpc: bad unlock balance in rxrpc_recvmsg
Subsystems (3)
PATCH 1/1 rxrpc: bad unlock balance in rxrpc_recvmsg
When either "goto wait_interrupted;" or "goto wait_error;" paths are taken, socket lock has already been released.
This patch fixes following syzbot splat :
WARNING: bad unlock balance detected!
5.0.0-rc4+ #59 Not tainted
-------------------------------------
syz-executor223/8256 is trying to release lock (sk_lock-AF_RXRPC) at:
[<ffffffff86651353>] rxrpc_recvmsg+0x6d3/0x3099 net/rxrpc/recvmsg.c:598 but there are no more locks to release!
other info that might help us debug this:
1 lock held by syz-executor223/8256:
#0: 00000000fa9ed0f4 (slock-AF_RXRPC){+...}, at: spin_lock_bh include/linux/spinlock.h:334 [inline] #0: 00000000fa9ed0f4 (slock-AF_RXRPC){+...}, at: release_sock+0x20/0x1c0 net/core/sock.c:2798
stack backtrace: CPU: 1 PID: 8256 Comm: syz-executor223 Not tainted 5.0.0-rc4+ #59 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x172/0x1f0 lib/dump_stack.c:113 print_unlock_imbalance_bug kernel/locking/lockdep.c:3391 [inline] print_unlock_imbalance_bug.cold+0x114/0x123 kernel/locking/lockdep.c:3368 __lock_release kernel/locking/lockdep.c:3601 [inline] lock_release+0x67e/0xa00 kernel/locking/lockdep.c:3860 sock_release_ownership include/net/sock.h:1471 [inline] release_sock+0x183/0x1c0 net/core/sock.c:2808 rxrpc_recvmsg+0x6d3/0x3099 net/rxrpc/recvmsg.c:598 sock_recvmsg_nosec net/socket.c:794 [inline] sock_recvmsg net/socket.c:801 [inline] sock_recvmsg+0xd0/0x110 net/socket.c:797 __sys_recvfrom+0x1ff/0x350 net/socket.c:1845 __do_sys_recvfrom net/socket.c:1863 [inline] __se_sys_recvfrom net/socket.c:1859 [inline] __x64_sys_recvfrom+0xe1/0x1a0 net/socket.c:1859 do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x446379 Code: e8 2c b3 02 00 48 83 c4 18 c3 0f 1f 80 00 00 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 2b 09 fc ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007fe5da89fd98 EFLAGS: 00000246 ORIG_RAX: 000000000000002d RAX: ffffffffffffffda RBX: 00000000006dbc28 RCX: 0000000000446379 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000003 RBP: 00000000006dbc20 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006dbc2c R13: 0000000000000000 R14: 0000000000000000 R15: 20c49ba5e353f7cf
--- net/rxrpc/recvmsg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/rxrpc/recvmsg.c +2 -1
@@ -596,6 +596,7 @@ int rxrpc_recvmsg(struct socket *sock, struct msghdr *msg, size_t len, } error_no_call:release_sock (&rx->sk); +error_trace:trace_rxrpc_recvmsg (call, rxrpc_recvmsg_return,0 ,0 ,0 , ret);return ret;
@@ -604,7 +605,7 @@ int rxrpc_recvmsg(struct socket *sock, struct msghdr *msg, size_t len, wait_error:finish_wait (sk_sleep (&rx->sk), &wait); call =NULL ; - goto error_no_call; + goto error_trace; }/**
Signature · 1 line
2.20.1.611.gfbb209baf1-goog
David Miller
maintainerFrom: Eric Dumazet <[email protected]>
Date: Mon, 4 Feb 2019 08:36:06 -0800
Quoted 4 lines
When either "goto
wait_interrupted;" or "gotowait_error;" paths are taken, socket lock has already been released.This patch fixes following syzbot splat :
...
Quoted 4 lines
Fixes 248f219cb8bc ("rxrpc: Rewrite the data and ack handling code")Signed-off-by Eric Dumazet <[email protected]>Cc David Howells <[email protected]>Reported-by syzbot <[email protected]>
David H., please take a look at this.
I can apply it directly and queue it up for -stable, just let me know.
Thanks.
David Miller
maintainerFrom: Eric Dumazet <[email protected]>
Date: Mon, 4 Feb 2019 08:36:06 -0800
Quoted 4 lines
When either "goto
wait_interrupted;" or "gotowait_error;" paths are taken, socket lock has already been released.This patch fixes following syzbot splat :
...
Quoted 4 lines
Fixes 248f219cb8bc ("rxrpc: Rewrite the data and ack handling code")Signed-off-by Eric Dumazet <[email protected]>Cc David Howells <[email protected]>Reported-by syzbot <[email protected]>
Series applied, thanks Eric.
From: David Miller <[email protected]>
Date: Wed, 06 Feb 2019 10:55:48 -0800 (PST)
Quoted 6 lines
From: Eric Dumazet <[email protected]>
Date: Mon, 4 Feb 2019 08:36:06 -0800Quoted 3 lines
When either "goto
wait_interrupted;" or "gotowait_error;" paths are taken, socket lock has already been released.
Quoted 8 lines
Quoted 1 line
This patch fixes following syzbot splat :
...
Quoted 4 lines
Fixes 248f219cb8bc ("rxrpc: Rewrite the data and ack handling code")Signed-off-by Eric Dumazet <[email protected]>Cc David Howells <[email protected]>Reported-by syzbot <[email protected]>Series applied, thanks Eric.
Of course, I meant:
Patch applied and queued up for -stable.
Sometimes I guess I am on autopilot :-)
Quoted 48 lines · Eric Dumazet
When either "goto
wait_interrupted;" or "gotowait_error;" paths are taken, socket lock has already been released.This patch fixes following syzbot splat :
WARNING: bad unlock balance detected!
5.0.0-rc4+ #59 Not tainted
-------------------------------------
syz-executor223/8256 is trying to release lock (sk_lock-AF_RXRPC) at:
[<ffffffff86651353>]rxrpc_recvmsg+0x6d3/0x3099net/rxrpc/recvmsg.c:598but there are no more locks to release!other info that might help us debug this:
1 lock held by syz-executor223/8256:
#0:00000000fa9ed0f4(slock-AF_RXRPC){+...}, at:spin_lock_bhinclude/linux/spinlock.h:334[inline] #0:00000000fa9ed0f4(slock-AF_RXRPC){+...}, at:release_sock+0x20/0x1c0net/core/sock.c:2798stack backtrace: CPU: 1 PID: 8256 Comm: syz-executor223 Not tainted 5.0.0-rc4+ #59 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x172/0x1f0 lib/dump_stack.c:113 print_unlock_imbalance_bug kernel/locking/lockdep.c:3391 [inline] print_unlock_imbalance_bug.cold+0x114/0x123 kernel/locking/lockdep.c:3368 __lock_release kernel/locking/lockdep.c:3601 [inline] lock_release+0x67e/0xa00 kernel/locking/lockdep.c:3860 sock_release_ownership include/net/sock.h:1471 [inline] release_sock+0x183/0x1c0 net/core/sock.c:2808 rxrpc_recvmsg+0x6d3/0x3099 net/rxrpc/recvmsg.c:598 sock_recvmsg_nosec net/socket.c:794 [inline] sock_recvmsg net/socket.c:801 [inline] sock_recvmsg+0xd0/0x110 net/socket.c:797 __sys_recvfrom+0x1ff/0x350 net/socket.c:1845 __do_sys_recvfrom net/socket.c:1863 [inline] __se_sys_recvfrom net/socket.c:1859 [inline] __x64_sys_recvfrom+0xe1/0x1a0 net/socket.c:1859 do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x446379 Code: e8 2c b3 02 00 48 83 c4 18 c3 0f 1f 80 00 00 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 2b 09 fc ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007fe5da89fd98 EFLAGS: 00000246 ORIG_RAX: 000000000000002d RAX: ffffffffffffffda RBX: 00000000006dbc28 RCX: 0000000000446379 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000003 RBP: 00000000006dbc20 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006dbc2c R13: 0000000000000000 R14: 0000000000000000 R15: 20c49ba5e353f7cf
Quoted 4 lines
Fixes 248f219cb8bc ("rxrpc: Rewrite the data and ack handling code")Signed-off-by Eric Dumazet <[email protected]>Cc David Howells <[email protected]>Reported-by syzbot <[email protected]>