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: e08d0b3d17 ("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-05-31 13:06:57 +02:00
2023-10-18 10:26:43 +02:00
2023-10-13 12:35:43 -07:00
2023-02-13 18:35:15 +08:00
2023-03-15 00:37:32 -07:00
2023-07-18 17:31:10 -07:00
2023-08-16 11:09:17 +01:00
2023-10-01 19:39:19 +01:00
2023-09-08 08:02:17 +01:00
2023-06-22 18:40:38 -07:00
2023-07-19 11:03:03 +01:00
2023-03-16 17:26:31 -07:00
2022-02-17 11:44:20 -08:00
2021-09-28 17:32:56 -07:00
2022-04-30 15:12:58 +01:00
2023-10-03 09:00:40 +02:00
2023-10-03 09:00:40 +02:00
2023-04-12 16:40:39 -07:00
2023-04-12 16:40:39 -07:00
2023-05-26 10:30:14 +01:00
2023-05-26 10:30:14 +01:00
2021-05-17 15:29:35 -07:00
2023-06-10 00:11:41 -07:00
2023-03-31 21:37:06 -07:00
2023-09-14 17:20:17 +02:00
2023-07-20 12:34:18 -07:00
2023-10-01 19:39:18 +01:00
2022-10-31 20:14:27 -07:00
2023-09-13 07:18:04 +01:00
2023-08-16 11:09:17 +01:00
2022-07-08 12:10:33 +01:00
2023-10-13 09:58:45 -07:00
2023-08-15 15:26:18 -07:00
2023-07-19 12:27:09 +01:00
2023-09-01 08:11:51 +01:00
2022-01-29 17:53:07 +00:00
2023-10-01 19:39:18 +01:00
2023-10-19 13:13:13 +02:00
2023-08-04 18:24:52 -07:00
2023-04-13 16:43:38 -07:00
2023-07-11 11:06:08 +02:00
2022-09-29 07:18:00 +02:00
2023-05-22 11:17:55 +01:00
2023-04-12 16:40:39 -07:00
2022-06-24 11:34:38 +01:00
2023-08-30 09:44:09 +01:00
2022-11-16 13:02:04 +00:00
2023-04-12 16:40:39 -07:00
2023-01-23 21:37:25 -08:00
2022-05-16 13:03:29 +02:00
2019-05-21 10:50:45 +02:00
2023-08-15 18:54:53 -07:00
2023-10-16 21:05:33 -07:00
2023-01-26 10:52:18 +01:00
2021-05-17 15:29:35 -07:00
2023-04-06 12:01:20 -07:00
2023-10-01 19:39:19 +01:00
2023-10-16 09:57:52 +01:00
2023-06-06 21:13:03 -07:00
2023-10-16 14:55:32 -07:00
2023-10-01 19:09:54 +01:00
2022-04-06 12:05:41 -07:00
2023-09-29 17:05:00 +02:00
2022-10-16 15:27:07 -07:00
2023-03-22 22:53:00 -07:00
2023-02-02 00:25:14 +01:00
2023-02-02 00:25:14 +01:00
2022-09-20 10:21:49 -07:00
2023-08-16 11:09:18 +01:00
2022-04-06 12:05:41 -07:00
2022-04-06 12:05:41 -07:00
2022-04-06 12:05:41 -07:00
2022-04-06 12:05:41 -07:00
2023-10-10 10:02:59 +02:00
2023-10-16 21:05:33 -07:00
2022-04-06 12:05:41 -07:00
2023-10-03 10:05:22 +02:00
2023-10-01 19:09:54 +01:00
2022-04-06 12:05:41 -07:00
2023-06-10 00:11:41 -07:00
2023-10-16 14:55:32 -07:00
2022-12-20 03:13:45 +01:00
2022-04-28 13:02:01 -07:00
2023-03-18 12:23:34 +00:00
2022-04-06 12:05:41 -07:00
2023-10-10 10:02:59 +02:00
2023-01-19 09:26:16 -08:00
2022-04-06 12:05:41 -07:00
2022-04-06 12:05:41 -07:00
2022-04-06 12:05:41 -07:00
2022-04-06 12:05:41 -07:00
2023-10-10 10:02:59 +02:00
2021-05-17 15:29:35 -07:00
2023-03-03 17:25:15 +01:00
2022-11-16 09:43:35 +00:00
2023-06-24 15:50:13 -07:00
2023-09-14 16:16:36 +02:00
2023-10-16 09:57:52 +01:00
2023-10-03 11:39:34 +02:00
2020-07-10 13:54:00 -07:00
2023-10-16 21:05:33 -07:00
2023-09-14 16:16:36 +02:00
2023-09-14 16:16:36 +02:00
2020-05-11 15:12:27 +02:00
2023-08-29 17:39:15 -07:00
2022-06-08 10:10:13 -07:00
2020-05-06 09:40:08 +02:00
2022-09-29 07:18:00 +02:00