From b70e7a78af2c4c090ca816d9f127a2f1e5866fb8 Mon Sep 17 00:00:00 2001 From: Josef Bacik Date: Fri, 15 Sep 2017 10:48:17 -0700 Subject: [PATCH] net: call sk_reuseport_match if we are a reusesock When adding the sk_reuseport_match helper I screwed up and made it so we unconditionally succeeded if our socket was a reuseport socket and the tb was marked reuseable. Fix this by actually calling sk_reuseport_match() to make sure our new socket matches the tb reuseport settings. Signed-off-by: Josef Bacik --- net/ipv4/inet_connection_sock.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index fe9cf4862de2..0e30e504c7d4 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c @@ -316,8 +316,7 @@ int inet_csk_get_port(struct sock *sk, unsigned short snum) if (sk->sk_reuse == SK_FORCE_REUSE) goto success; - if ((tb->fastreuse > 0 && reuse) || - sk_reuseport_match(tb, sk)) + if (tb->fastreuse > 0 && reuse && sk_reuseport_match(tb, sk)) goto success; if (inet_csk_bind_conflict(sk, tb, true, true)) goto fail_unlock; -- 2.13.5