diff options
author | 2023-03-15 00:22:43 -0700 | |
---|---|---|
committer | 2023-03-15 00:24:10 -0700 | |
commit | cf18d55e535b34fd4845e87e31e1c5609db6d0a3 (patch) | |
tree | 23b3754de0ef2cf10419edd90b3b8ffc34709d30 /net | |
parent | net: phy: smsc: bail out in lan87xx_read_status if genphy_read_status fails (diff) | |
parent | selftest: Add test for bind() conflicts. (diff) | |
download | linux-rng-cf18d55e535b34fd4845e87e31e1c5609db6d0a3.tar.xz linux-rng-cf18d55e535b34fd4845e87e31e1c5609db6d0a3.zip |
Merge branch 'tcp-fix-bind-regression-for-dual-stack-wildcard-address'
Kuniyuki Iwashima says:
====================
tcp: Fix bind() regression for dual-stack wildcard address.
The first patch fixes the regression reported in [0], and the second
patch adds a test for similar cases to catch future regression.
[0]: https://lore.kernel.org/netdev/e21bf153-80b0-9ec0-15ba-e04a4ad42c34@redhat.com/
====================
Link: https://lore.kernel.org/r/20230312031904.4674-1-kuniyu@amazon.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/inet_hashtables.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c index e41fdc38ce19..6edae3886885 100644 --- a/net/ipv4/inet_hashtables.c +++ b/net/ipv4/inet_hashtables.c @@ -828,8 +828,14 @@ bool inet_bind2_bucket_match_addr_any(const struct inet_bind2_bucket *tb, const #if IS_ENABLED(CONFIG_IPV6) struct in6_addr addr_any = {}; - if (sk->sk_family != tb->family) + if (sk->sk_family != tb->family) { + if (sk->sk_family == AF_INET) + return net_eq(ib2_net(tb), net) && tb->port == port && + tb->l3mdev == l3mdev && + ipv6_addr_equal(&tb->v6_rcv_saddr, &addr_any); + return false; + } if (sk->sk_family == AF_INET6) return net_eq(ib2_net(tb), net) && tb->port == port && |