Message ID | 20210621145348.695341-1-eric.dumazet@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 64295f0d01ae0661a2cea42c598070b1c87ca6e0 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net-next] virtio/vsock: avoid NULL deref in virtio_transport_seqpacket_allow() | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net-next |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | warning | 4 maintainers not CCed: kvm@vger.kernel.org virtualization@lists.linux-foundation.org sgarzare@redhat.com stefanha@redhat.com |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | warning | WARNING: Possible repeated word: 'Google' |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | Link |
On Mon, Jun 21, 2021 at 07:53:48AM -0700, Eric Dumazet wrote: >From: Eric Dumazet <edumazet@google.com> > >Make sure the_virtio_vsock is not NULL before dereferencing it. > >general protection fault, probably for non-canonical address 0xdffffc0000000071: 0000 [#1] PREEMPT SMP KASAN >KASAN: null-ptr-deref in range [0x0000000000000388-0x000000000000038f] >CPU: 0 PID: 8452 Comm: syz-executor406 Not tainted 5.13.0-rc6-syzkaller #0 >Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 >RIP: 0010:virtio_transport_seqpacket_allow+0xbf/0x210 net/vmw_vsock/virtio_transport.c:503 >Code: e8 c6 d9 ab f8 84 db 0f 84 0f 01 00 00 e8 09 d3 ab f8 48 8d bd 88 03 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 04 02 84 c0 74 06 0f 8e 2a 01 00 00 44 0f b6 a5 88 03 00 00 >RSP: 0018:ffffc90003757c18 EFLAGS: 00010206 >RAX: dffffc0000000000 RBX: 0000000000000001 RCX: 0000000000000000 >RDX: 0000000000000071 RSI: ffffffff88c908e7 RDI: 0000000000000388 >RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 >R10: ffffffff88c90a06 R11: 0000000000000000 R12: 0000000000000000 >R13: ffffffff88c90840 R14: 0000000000000000 R15: 0000000000000001 >FS: 0000000001bee300(0000) GS:ffff8880b9c00000(0000) knlGS:0000000000000000 >CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 >CR2: 0000000020000082 CR3: 000000002847e000 CR4: 00000000001506f0 >DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 >DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 >Call Trace: > vsock_assign_transport+0x575/0x700 net/vmw_vsock/af_vsock.c:490 > vsock_connect+0x200/0xc00 net/vmw_vsock/af_vsock.c:1337 > __sys_connect_file+0x155/0x1a0 net/socket.c:1824 > __sys_connect+0x161/0x190 net/socket.c:1841 > __do_sys_connect net/socket.c:1851 [inline] > __se_sys_connect net/socket.c:1848 [inline] > __x64_sys_connect+0x6f/0xb0 net/socket.c:1848 > do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47 > entry_SYSCALL_64_after_hwframe+0x44/0xae >RIP: 0033:0x43ee69 >Code: 28 c3 e8 2a 14 00 00 66 2e 0f 1f 84 00 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 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48 >RSP: 002b:00007ffd49e7c788 EFLAGS: 00000246 ORIG_RAX: 000000000000002a >RAX: ffffffffffffffda RBX: 0000000000400488 RCX: 000000000043ee69 >RDX: 0000000000000010 RSI: 0000000020000080 RDI: 0000000000000003 >RBP: 0000000000402e50 R08: 0000000000000000 R09: 0000000000400488 >R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000402ee0 >R13: 0000000000000000 R14: 00000000004ac018 R15: 0000000000400488 > >Fixes: 53efbba12cc7 ("virtio/vsock: enable SEQPACKET for transport") >Signed-off-by: Eric Dumazet <edumazet@google.com> >Cc: Arseny Krasnov <arseny.krasnov@kaspersky.com> >Reported-by: syzbot <syzkaller@googlegroups.com> >--- > net/vmw_vsock/virtio_transport.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > >diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transport.c >index e73ce652bf3c3c291a12e95d26cdbd24747a7467..ed1664e7bd88840c4e336628efa76048e55f37c0 100644 >--- a/net/vmw_vsock/virtio_transport.c >+++ b/net/vmw_vsock/virtio_transport.c >@@ -498,9 +498,11 @@ static bool virtio_transport_seqpacket_allow(u32 remote_cid) > struct virtio_vsock *vsock; > bool seqpacket_allow; > >+ seqpacket_allow = false; > rcu_read_lock(); > vsock = rcu_dereference(the_virtio_vsock); >- seqpacket_allow = vsock->seqpacket_allow; >+ if (vsock) >+ seqpacket_allow = vsock->seqpacket_allow; > rcu_read_unlock(); > > return seqpacket_allow; >-- >2.32.0.288.g62a8d224e6-goog > Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Hello: This patch was applied to netdev/net-next.git (refs/heads/master): On Mon, 21 Jun 2021 07:53:48 -0700 you wrote: > From: Eric Dumazet <edumazet@google.com> > > Make sure the_virtio_vsock is not NULL before dereferencing it. > > general protection fault, probably for non-canonical address 0xdffffc0000000071: 0000 [#1] PREEMPT SMP KASAN > KASAN: null-ptr-deref in range [0x0000000000000388-0x000000000000038f] > CPU: 0 PID: 8452 Comm: syz-executor406 Not tainted 5.13.0-rc6-syzkaller #0 > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 > RIP: 0010:virtio_transport_seqpacket_allow+0xbf/0x210 net/vmw_vsock/virtio_transport.c:503 > Code: e8 c6 d9 ab f8 84 db 0f 84 0f 01 00 00 e8 09 d3 ab f8 48 8d bd 88 03 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 04 02 84 c0 74 06 0f 8e 2a 01 00 00 44 0f b6 a5 88 03 00 00 > RSP: 0018:ffffc90003757c18 EFLAGS: 00010206 > RAX: dffffc0000000000 RBX: 0000000000000001 RCX: 0000000000000000 > RDX: 0000000000000071 RSI: ffffffff88c908e7 RDI: 0000000000000388 > RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 > R10: ffffffff88c90a06 R11: 0000000000000000 R12: 0000000000000000 > R13: ffffffff88c90840 R14: 0000000000000000 R15: 0000000000000001 > FS: 0000000001bee300(0000) GS:ffff8880b9c00000(0000) knlGS:0000000000000000 > CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > CR2: 0000000020000082 CR3: 000000002847e000 CR4: 00000000001506f0 > DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 > DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 > Call Trace: > vsock_assign_transport+0x575/0x700 net/vmw_vsock/af_vsock.c:490 > vsock_connect+0x200/0xc00 net/vmw_vsock/af_vsock.c:1337 > __sys_connect_file+0x155/0x1a0 net/socket.c:1824 > __sys_connect+0x161/0x190 net/socket.c:1841 > __do_sys_connect net/socket.c:1851 [inline] > __se_sys_connect net/socket.c:1848 [inline] > __x64_sys_connect+0x6f/0xb0 net/socket.c:1848 > do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47 > entry_SYSCALL_64_after_hwframe+0x44/0xae > RIP: 0033:0x43ee69 > Code: 28 c3 e8 2a 14 00 00 66 2e 0f 1f 84 00 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 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48 > RSP: 002b:00007ffd49e7c788 EFLAGS: 00000246 ORIG_RAX: 000000000000002a > RAX: ffffffffffffffda RBX: 0000000000400488 RCX: 000000000043ee69 > RDX: 0000000000000010 RSI: 0000000020000080 RDI: 0000000000000003 > RBP: 0000000000402e50 R08: 0000000000000000 R09: 0000000000400488 > R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000402ee0 > R13: 0000000000000000 R14: 00000000004ac018 R15: 0000000000400488 > > [...] Here is the summary with links: - [net-next] virtio/vsock: avoid NULL deref in virtio_transport_seqpacket_allow() https://git.kernel.org/netdev/net-next/c/64295f0d01ae You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transport.c index e73ce652bf3c3c291a12e95d26cdbd24747a7467..ed1664e7bd88840c4e336628efa76048e55f37c0 100644 --- a/net/vmw_vsock/virtio_transport.c +++ b/net/vmw_vsock/virtio_transport.c @@ -498,9 +498,11 @@ static bool virtio_transport_seqpacket_allow(u32 remote_cid) struct virtio_vsock *vsock; bool seqpacket_allow; + seqpacket_allow = false; rcu_read_lock(); vsock = rcu_dereference(the_virtio_vsock); - seqpacket_allow = vsock->seqpacket_allow; + if (vsock) + seqpacket_allow = vsock->seqpacket_allow; rcu_read_unlock(); return seqpacket_allow;