Eric Dumazet
b320a45638
bpf, sockmap: Avoid potential NULL dereference in sk_psock_verdict_data_ready()
...
syzbot found sk_psock(sk) could return NULL when called
from sk_psock_verdict_data_ready().
Just make sure to handle this case.
[1]
general protection fault, probably for non-canonical address 0xdffffc000000005c: 0000 [#1 ] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x00000000000002e0-0x00000000000002e7]
CPU: 0 PID: 15 Comm: ksoftirqd/0 Not tainted 6.4.0-rc3-syzkaller-00588-g4781e965e655 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/16/2023
RIP: 0010:sk_psock_verdict_data_ready+0x19f/0x3c0 net/core/skmsg.c:1213
Code: 4c 89 e6 e8 63 70 5e f9 4d 85 e4 75 75 e8 19 74 5e f9 48 8d bb e0 02 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 07 02 00 00 48 89 ef ff 93 e0 02 00 00 e8 29 fd
RSP: 0018:ffffc90000147688 EFLAGS: 00010206
RAX: dffffc0000000000 RBX: 0000000000000000 RCX: 0000000000000100
RDX: 000000000000005c RSI: ffffffff8825ceb7 RDI: 00000000000002e0
RBP: ffff888076518c40 R08: 0000000000000007 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000008000 R15: ffff888076518c40
FS: 0000000000000000(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f901375bab0 CR3: 000000004bf26000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
tcp_data_ready+0x10a/0x520 net/ipv4/tcp_input.c:5006
tcp_data_queue+0x25d3/0x4c50 net/ipv4/tcp_input.c:5080
tcp_rcv_established+0x829/0x1f90 net/ipv4/tcp_input.c:6019
tcp_v4_do_rcv+0x65a/0x9c0 net/ipv4/tcp_ipv4.c:1726
tcp_v4_rcv+0x2cbf/0x3340 net/ipv4/tcp_ipv4.c:2148
ip_protocol_deliver_rcu+0x9f/0x480 net/ipv4/ip_input.c:205
ip_local_deliver_finish+0x2ec/0x520 net/ipv4/ip_input.c:233
NF_HOOK include/linux/netfilter.h:303 [inline]
NF_HOOK include/linux/netfilter.h:297 [inline]
ip_local_deliver+0x1ae/0x200 net/ipv4/ip_input.c:254
dst_input include/net/dst.h:468 [inline]
ip_rcv_finish+0x1cf/0x2f0 net/ipv4/ip_input.c:449
NF_HOOK include/linux/netfilter.h:303 [inline]
NF_HOOK include/linux/netfilter.h:297 [inline]
ip_rcv+0xae/0xd0 net/ipv4/ip_input.c:569
__netif_receive_skb_one_core+0x114/0x180 net/core/dev.c:5491
__netif_receive_skb+0x1f/0x1c0 net/core/dev.c:5605
process_backlog+0x101/0x670 net/core/dev.c:5933
__napi_poll+0xb7/0x6f0 net/core/dev.c:6499
napi_poll net/core/dev.c:6566 [inline]
net_rx_action+0x8a9/0xcb0 net/core/dev.c:6699
__do_softirq+0x1d4/0x905 kernel/softirq.c:571
run_ksoftirqd kernel/softirq.c:939 [inline]
run_ksoftirqd+0x31/0x60 kernel/softirq.c:931
smpboot_thread_fn+0x659/0x9e0 kernel/smpboot.c:164
kthread+0x344/0x440 kernel/kthread.c:379
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308
</TASK>
Fixes: 6df7f764cd3c ("bpf, sockmap: Wake up polling after data copy")
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: John Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/bpf/20230530195149.68145-1-edumazet@google.com
2023-06-01 14:44:53 +02:00
..
2023-03-29 08:22:52 +01:00
2023-05-05 19:12:01 -07:00
2023-05-17 12:55:39 +01:00
2023-05-17 21:27:30 -07:00
2023-04-23 14:16:44 +01:00
2023-05-19 15:37:45 -07:00
2023-04-21 11:34:50 -07:00
2023-05-17 21:28:58 -07:00
2023-03-02 22:22:07 -08:00
2023-05-15 22:24:46 +02:00
2023-02-21 18:24:12 -08:00
2023-06-01 14:44:53 +02:00
2023-03-22 21:50:23 +01:00
2023-05-16 19:57:52 -07:00
2023-04-23 14:16:45 +01:00
2023-05-03 09:13:20 +01:00
2023-05-24 22:05:24 -07:00
2023-03-16 21:11:03 -07:00
2023-03-17 09:13:53 +01:00
2023-06-01 13:15:12 +02:00
2023-05-25 10:51:58 +02:00
2023-03-16 17:34:40 -07:00
2023-05-10 07:04:51 +02:00
2023-03-31 09:25:12 +01:00
2023-05-10 10:03:32 +01:00
2023-05-16 10:26:00 -07:00
2023-04-05 13:48:04 +00:00
2023-03-09 23:06:21 -08:00
2023-02-15 10:26:37 +00:00
2023-04-20 16:29:51 -07:00
2023-04-28 09:35:33 +01:00
2023-05-17 14:18:28 +02:00
2023-05-31 00:02:24 -07:00
2023-05-25 21:02:29 -07:00
2023-03-07 13:37:05 -08:00
2023-05-15 08:40:27 +01:00
2023-04-07 19:42:53 -07:00
2023-05-29 22:03:48 -07:00
2023-04-13 09:35:30 +02:00
2023-02-13 09:33:39 +00:00
2023-04-06 20:36:27 +02:00
2023-05-30 10:01:06 +02:00
2023-06-01 12:59:04 +02:00
2023-05-22 11:05:20 +01:00
2023-05-30 11:26:32 +02:00
2023-05-22 12:01:13 -07:00
2023-05-15 10:21:20 +01:00
2023-05-26 10:35:58 +01:00
2023-05-23 16:09:47 +02:00
2023-05-23 16:09:47 +02:00
2023-05-16 10:09:50 -07:00
2023-04-13 16:43:38 -07:00
2023-05-16 20:52:35 -07:00
2023-04-14 11:09:27 +01:00
2023-04-19 18:48:48 -07:00
2023-04-19 18:48:48 -07:00
2023-05-10 09:58:29 +01:00