Kuniyuki Iwashima
e0833d1fed
dccp/tcp: Fixup bhash2 bucket when connect() fails.
...
If a socket bound to a wildcard address fails to connect(), we
only reset saddr and keep the port. Then, we have to fix up the
bhash2 bucket; otherwise, the bucket has an inconsistent address
in the list.
Also, listen() for such a socket will fire the WARN_ON() in
inet_csk_get_port(). [0]
Note that when a system runs out of memory, we give up fixing the
bucket and unlink sk from bhash and bhash2 by inet_put_port().
[0]:
WARNING: CPU: 0 PID: 207 at net/ipv4/inet_connection_sock.c:548 inet_csk_get_port (net/ipv4/inet_connection_sock.c:548 (discriminator 1))
Modules linked in:
CPU: 0 PID: 207 Comm: bhash2_prev_rep Not tainted 6.1.0-rc3-00799-gc8421681c845 #63
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.0-1.amzn2022.0.1 04/01/2014
RIP: 0010:inet_csk_get_port (net/ipv4/inet_connection_sock.c:548 (discriminator 1))
Code: 74 a7 eb 93 48 8b 54 24 18 0f b7 cb 4c 89 e6 4c 89 ff e8 48 b2 ff ff 49 8b 87 18 04 00 00 e9 32 ff ff ff 0f 0b e9 34 ff ff ff <0f> 0b e9 42 ff ff ff 41 8b 7f 50 41 8b 4f 54 89 fe 81 f6 00 00 ff
RSP: 0018:ffffc900003d7e50 EFLAGS: 00010202
RAX: ffff8881047fb500 RBX: 0000000000004e20 RCX: 0000000000000000
RDX: 000000000000000a RSI: 00000000fffffe00 RDI: 00000000ffffffff
RBP: ffffffff8324dc00 R08: 0000000000000001 R09: 0000000000000001
R10: 0000000000000001 R11: 0000000000000001 R12: 0000000000000000
R13: 0000000000000001 R14: 0000000000004e20 R15: ffff8881054e1280
FS: 00007f8ac04dc740(0000) GS:ffff88842fc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020001540 CR3: 00000001055fa003 CR4: 0000000000770ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
PKRU: 55555554
Call Trace:
<TASK>
inet_csk_listen_start (net/ipv4/inet_connection_sock.c:1205)
inet_listen (net/ipv4/af_inet.c:228)
__sys_listen (net/socket.c:1810)
__x64_sys_listen (net/socket.c:1819 net/socket.c:1817 net/socket.c:1817)
do_syscall_64 (arch/x86/entry/common.c:50 arch/x86/entry/common.c:80)
entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:120)
RIP: 0033:0x7f8ac051de5d
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 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 8b 0d 93 af 1b 00 f7 d8 64 89 01 48
RSP: 002b:00007ffc1c177248 EFLAGS: 00000206 ORIG_RAX: 0000000000000032
RAX: ffffffffffffffda RBX: 0000000020001550 RCX: 00007f8ac051de5d
RDX: ffffffffffffff80 RSI: 0000000000000000 RDI: 0000000000000004
RBP: 00007ffc1c177270 R08: 0000000000000018 R09: 0000000000000007
R10: 0000000020001540 R11: 0000000000000206 R12: 00007ffc1c177388
R13: 0000000000401169 R14: 0000000000403e18 R15: 00007f8ac0723000
</TASK>
Fixes: 28044fc1d495 ("net: Add a bhash2 table hashed by port and address")
Reported-by: syzbot <syzkaller@googlegroups.com>
Reported-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Acked-by: Joanne Koong <joannelkoong@gmail.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-11-22 20:15:37 -08:00
..
2022-10-05 07:05:41 +09:00
2022-09-09 12:25:18 -07:00
2021-07-01 13:19:48 -07:00
2021-11-19 11:52:25 +00:00
2022-10-11 17:42:58 -06:00
2022-09-28 18:51:47 -07:00
2021-11-17 20:17:05 -08:00
2022-07-22 12:53:22 +01:00
2022-04-12 15:00:25 +02:00
2022-05-12 16:15:30 -07:00
2022-09-09 08:24:41 +01:00
2022-07-28 10:42:44 -07:00
2022-09-01 11:44:13 +01:00
2022-06-22 12:59:43 +01:00
2022-08-23 10:43:11 +02:00
2022-07-22 12:53:22 +01:00
2022-02-21 11:44:30 +00:00
2022-07-28 22:06:15 -07:00
2022-08-09 22:14:02 -07:00
2021-12-13 12:34:09 +00:00
2022-09-16 14:34:01 +01:00
2021-12-03 14:16:48 +00:00
2022-07-22 12:53:22 +01:00
2022-09-16 14:34:01 +01:00
2021-03-26 17:43:55 +01:00
2022-08-24 13:46:58 +01:00
2022-08-25 11:07:26 +02:00
2022-05-22 21:51:54 +01:00
2022-03-11 10:57:22 +00:00
2020-07-15 07:45:24 -07:00
2021-12-22 15:03:47 -08:00
2022-07-22 12:53:22 +01:00
2021-12-22 15:03:51 -08:00
2022-07-24 18:39:17 -06:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2022-09-30 18:17:16 -07:00
2022-09-07 15:28:08 +01:00
2022-09-30 18:17:17 -07:00
2021-11-29 19:50:45 -08:00
2022-10-03 07:52:13 +01:00
2022-09-26 11:48:14 -07:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2021-12-06 16:06:02 -08:00
2021-12-16 07:18:35 -08:00
2022-07-28 22:21:54 -07:00
2022-09-20 09:13:38 +02:00
2022-09-20 09:13:38 +02:00
2022-10-03 12:41:59 +01:00
2022-07-11 19:49:38 -07:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2021-10-18 12:54:41 +01:00
2022-10-24 19:08:46 -07:00
2021-01-29 20:39:14 -08:00
2022-08-25 16:07:42 -07:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2021-06-28 14:29:45 -07:00
2022-02-04 16:25:21 +01:00
2022-10-07 08:42:00 +01:00
2022-04-06 22:09:39 -07:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2022-07-29 11:58:54 +01:00
2022-07-22 12:53:22 +01:00
2022-08-24 19:30:07 -07:00
2022-02-07 20:12:45 -08:00
2021-10-15 11:33:08 +01:00
2022-07-22 12:53:22 +01:00
2022-11-22 20:15:37 -08:00
2022-07-29 11:58:54 +01:00
2022-05-13 12:24:12 +01:00
2022-02-17 07:00:39 -06:00
2021-11-16 13:16:54 +00:00
2022-02-17 11:44:20 -08:00
2022-07-22 12:53:22 +01:00
2022-04-25 11:40:45 +01:00
2022-04-11 17:37:50 -07:00
2022-10-03 07:59:06 +01:00
2021-10-07 19:52:58 +02:00
2022-11-17 10:42:45 +01:00
2022-09-29 07:18:00 +02:00
2022-07-22 12:53:22 +01:00
2022-02-04 14:15:11 -08:00
2022-09-02 20:34:32 -07:00
2022-11-17 10:42:45 +01:00
2021-03-23 14:14:50 -07:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2021-12-07 20:44:59 -08:00
2021-10-13 09:40:46 -07:00
2021-07-27 13:05:56 +01:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2022-07-28 11:29:36 +02:00
2021-11-07 19:25:29 +00:00
2021-08-30 01:51:36 +02:00
2022-09-06 10:17:20 +02:00
2022-04-25 20:51:12 +02:00
2022-09-23 06:56:08 -07:00
2022-04-01 12:04:15 +01:00
2021-10-29 13:23:51 +01:00
2021-03-26 15:14:56 -07:00
2022-07-22 12:53:22 +01:00
2022-08-08 15:30:45 +02:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2022-03-03 11:55:12 -08:00
2022-11-18 10:29:50 +00:00
2022-05-11 12:43:10 +01:00
2022-07-11 16:25:14 +02:00
2021-12-10 06:38:26 -08:00
2022-07-22 12:53:22 +01:00
2022-11-01 21:29:06 -07:00
2022-07-22 12:53:22 +01:00
2021-09-24 14:07:10 +01:00
2022-09-02 19:59:08 -07:00
2022-07-22 12:53:22 +01:00
2022-04-15 10:43:47 +01:00
2022-04-12 15:00:25 +02:00
2022-10-02 16:07:17 +01:00
2022-09-29 18:52:05 -07:00
2022-07-22 12:53:22 +01:00
2022-07-15 18:50:35 -07:00
2021-08-09 15:34:21 -07:00
2022-07-22 12:53:22 +01:00
2022-07-14 15:27:35 -07:00
2022-06-19 10:00:02 +01:00
2022-10-11 17:42:58 -06:00
2022-07-22 12:53:22 +01:00
2022-02-02 14:45:18 +00:00
2022-08-01 11:59:23 -07:00
2022-07-25 13:25:39 +01:00
2022-04-13 12:46:26 +01:00
2022-09-29 18:52:01 -07:00
2020-07-13 11:03:44 -07:00
2022-07-22 12:53:22 +01:00
2022-01-04 12:17:35 +00:00
2021-04-28 14:06:45 -07:00
2022-07-27 13:24:42 +01:00
2022-10-18 10:17:18 +02:00
2022-11-16 12:52:19 +00:00
2021-08-03 13:05:26 +01:00
2022-07-22 12:53:22 +01:00
2022-07-18 11:24:10 +01:00
2022-06-29 20:37:36 -07:00
2022-10-03 17:44:18 -07:00
2022-09-22 17:27:41 -07:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2022-09-01 11:42:12 +01:00
2022-10-12 17:50:37 -07:00
2022-10-12 17:50:37 -07:00
2022-03-01 08:38:02 +00:00
2022-07-22 12:53:22 +01:00
2022-09-30 07:55:46 -07:00
2021-12-29 08:48:14 -08:00
2022-09-26 13:28:19 -07:00
2022-09-29 07:17:58 +02:00
2022-09-22 17:16:22 +02:00