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