Eric Dumazet
878d951c67
inet: lock the socket in ip_sock_set_tos()
...
Christoph Paasch reported a panic in TCP stack [1]
Indeed, we should not call sk_dst_reset() without holding
the socket lock, as __sk_dst_get() callers do not all rely
on bare RCU.
[1]
BUG: kernel NULL pointer dereference, address: 0000000000000000
PGD 12bad6067 P4D 12bad6067 PUD 12bad5067 PMD 0
Oops: 0000 [#1 ] PREEMPT SMP
CPU: 1 PID: 2750 Comm: syz-executor.5 Not tainted 6.6.0-rc4-g7a5720a344e7 #49
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.11.0-2.el7 04/01/2014
RIP: 0010:tcp_get_metrics+0x118/0x8f0 net/ipv4/tcp_metrics.c:321
Code: c7 44 24 70 02 00 8b 03 89 44 24 48 c7 44 24 4c 00 00 00 00 66 c7 44 24 58 02 00 66 ba 02 00 b1 01 89 4c 24 04 4c 89 7c 24 10 <49> 8b 0f 48 8b 89 50 05 00 00 48 89 4c 24 30 33 81 00 02 00 00 69
RSP: 0018:ffffc90000af79b8 EFLAGS: 00010293
RAX: 000000000100007f RBX: ffff88812ae8f500 RCX: ffff88812b5f8f01
RDX: 0000000000000002 RSI: ffffffff8300f080 RDI: 0000000000000002
RBP: 0000000000000002 R08: 0000000000000003 R09: ffffffff8205eca0
R10: 0000000000000002 R11: ffff88812b5f8f00 R12: ffff88812a9e0580
R13: 0000000000000000 R14: ffff88812ae8fbd2 R15: 0000000000000000
FS: 00007f70a006b640(0000) GS:ffff88813bd00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 000000012bad7003 CR4: 0000000000170ee0
Call Trace:
<TASK>
tcp_fastopen_cache_get+0x32/0x140 net/ipv4/tcp_metrics.c:567
tcp_fastopen_cookie_check+0x28/0x180 net/ipv4/tcp_fastopen.c:419
tcp_connect+0x9c8/0x12a0 net/ipv4/tcp_output.c:3839
tcp_v4_connect+0x645/0x6e0 net/ipv4/tcp_ipv4.c:323
__inet_stream_connect+0x120/0x590 net/ipv4/af_inet.c:676
tcp_sendmsg_fastopen+0x2d6/0x3a0 net/ipv4/tcp.c:1021
tcp_sendmsg_locked+0x1957/0x1b00 net/ipv4/tcp.c:1073
tcp_sendmsg+0x30/0x50 net/ipv4/tcp.c:1336
__sock_sendmsg+0x83/0xd0 net/socket.c:730
__sys_sendto+0x20a/0x2a0 net/socket.c:2194
__do_sys_sendto net/socket.c:2206 [inline]
Fixes: e08d0b3d1723 ("inet: implement lockless IP_TOS")
Reported-by: Christoph Paasch <cpaasch@apple.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://lore.kernel.org/r/20231018090014.345158-1-edumazet@google.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2023-10-19 13:13:13 +02:00
..
2023-09-11 08:20:52 +02:00
2023-04-24 12:28:34 -07:00
2023-08-25 12:36:57 +01:00
2023-10-16 21:05:33 -07:00
2023-08-28 18:46:47 -07:00
2023-09-01 15:58:21 -07:00
2023-06-12 16:39:11 -06:00
2023-07-31 20:11:42 -07:00
2023-01-30 15:04:52 -07:00
2022-10-05 11:05:18 -06:00
2023-06-12 16:39:11 -06:00
2023-08-21 13:37:37 -07:00
2023-02-13 09:09:44 -07:00
2023-10-13 10:43:13 +01:00
2022-11-22 09:09:04 -07:00
2023-09-19 13:21:32 -07:00
2023-08-24 10:41:47 -04:00
2023-08-16 10:10:39 -06:00
2023-09-15 19:22:20 -07:00
2023-08-16 10:48:10 -06:00
2023-06-29 10:11:10 -07:00
2023-07-13 19:13:24 -07:00
2022-10-18 14:13:19 -06:00
2023-08-18 12:52:15 -03:00
2023-02-13 09:09:44 -07:00
2023-02-13 09:09:45 -07:00
2022-10-18 14:13:25 -06:00
2022-11-08 15:44:02 +01:00
2023-09-12 09:10:36 -07:00
2023-09-23 05:35:55 -04:00
2023-08-30 18:53:08 +02:00
2022-10-05 13:00:03 +02:00
2023-06-12 16:39:10 -06:00
2023-02-23 09:37:29 -08:00
2023-08-21 13:38:00 -07:00
2022-10-18 14:21:18 -06:00
2023-07-13 12:51:13 -06:00
2023-09-29 17:20:48 -07:00
2023-03-31 09:18:45 -06:00
2023-02-13 09:09:45 -07:00
2022-11-21 10:49:58 +00:00
2023-10-19 13:13:13 +02:00
2023-10-18 11:09:55 +01:00
2023-08-28 19:03:24 -07:00
2023-09-19 13:21:32 -07:00
2023-02-13 09:09:45 -07:00
2023-02-13 09:09:45 -07:00
2023-06-12 16:39:11 -06:00
2023-09-22 20:29:48 +10:00
2023-07-25 10:33:25 -06:00
2023-09-19 13:21:33 -07:00
2023-10-15 20:07:52 +01:00
2023-04-25 11:05:04 -07:00
2023-08-28 13:42:29 -07:00
2023-07-25 08:54:11 -06:00
2023-09-01 08:09:48 -07:00
2023-08-28 18:46:47 -07:00
2022-11-15 13:30:51 -07:00
2023-03-28 10:27:07 -06:00
2023-08-10 13:26:19 -07:00
2023-05-08 11:01:03 -06:00
2023-03-20 17:28:31 -06:00
2022-11-29 17:28:31 -07:00
2023-02-13 09:09:45 -07:00
2023-06-18 02:32:54 -07:00
2023-10-18 18:07:51 -07:00
2023-02-13 09:09:46 -07:00
2022-10-25 15:15:52 -07:00
2023-07-13 13:32:36 -06:00
2023-02-13 09:09:46 -07:00
2023-06-15 13:45:42 +02:00
2023-09-18 11:04:52 -06:00
2023-06-12 16:39:10 -06:00
2022-10-27 02:53:37 -06:00
2023-08-21 13:46:25 -07:00
2023-09-01 23:34:13 +02:00
2023-09-08 10:06:49 -06:00
2023-08-10 23:10:09 -07:00
2023-08-18 10:12:42 -07:00
2023-09-08 10:06:56 -06:00
2023-09-26 18:47:37 -06:00
2023-06-12 16:39:11 -06:00