Re: [syzbot] [net?] WARNING in inet_csk_get_port (3)

From: Hillf Danton
Date: Mon May 27 2024 - 06:51:04 EST


On Mon, 06 May 2024 01:37:21 -0700
> syzbot found the following issue on:
>
> HEAD commit: 977b1ef51866 Merge tag 'block-6.9-20240420' of git://git.k..
> git tree: upstream
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11135520980000

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 977b1ef51866

--- x/net/ipv4/inet_connection_sock.c
+++ y/net/ipv4/inet_connection_sock.c
@@ -589,7 +589,7 @@ int inet_csk_get_port(struct sock *sk, u
success:
inet_csk_update_fastreuse(tb, sk);

- if (!inet_csk(sk)->icsk_bind_hash)
+ if (tb != inet_csk(sk)->icsk_bind_hash || inet_csk(sk)->icsk_bind2_hash != tb2)
inet_bind_hash(sk, tb, tb2, port);
WARN_ON(inet_csk(sk)->icsk_bind_hash != tb);
WARN_ON(inet_csk(sk)->icsk_bind2_hash != tb2);
--