49af9ed
From patchwork Mon Sep 18 16:28:55 2017
49af9ed
Content-Type: text/plain; charset="utf-8"
49af9ed
MIME-Version: 1.0
49af9ed
Content-Transfer-Encoding: 7bit
49af9ed
Subject: [1/3] net: set tb->fast_sk_family
49af9ed
X-Patchwork-Submitter: Josef Bacik <josef@toxicpanda.com>
49af9ed
X-Patchwork-Id: 815031
49af9ed
X-Patchwork-Delegate: davem@davemloft.net
49af9ed
Message-Id: <1505752137-15522-2-git-send-email-jbacik@fb.com>
49af9ed
To: davem@davemloft.net, netdev@vger.kernel.org,
49af9ed
 linux-kernel@vger.kernel.org, crobinso@redhat.com,
49af9ed
 labbott@redhat.com, kernel-team@fb.com
49af9ed
Cc: Josef Bacik <jbacik@fb.com>, stable@vger.kernel.org
49af9ed
Date: Mon, 18 Sep 2017 12:28:55 -0400
49af9ed
From: josef@toxicpanda.com
49af9ed
List-Id: <netdev.vger.kernel.org>
49af9ed
49af9ed
From: Josef Bacik <jbacik@fb.com>
49af9ed
49af9ed
We need to set the tb->fast_sk_family properly so we can use the proper
49af9ed
comparison function for all subsequent reuseport bind requests.
49af9ed
49af9ed
Cc: stable@vger.kernel.org
49af9ed
Fixes: 637bc8bbe6c0 ("inet: reset tb->fastreuseport when adding a reuseport sk")
49af9ed
Reported-and-tested-by: Cole Robinson <crobinso@redhat.com>
49af9ed
Signed-off-by: Josef Bacik <jbacik@fb.com>
49af9ed
---
49af9ed
 net/ipv4/inet_connection_sock.c | 2 ++
49af9ed
 1 file changed, 2 insertions(+)
49af9ed
49af9ed
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
49af9ed
index b9c64b40a83a..f87f4805e244 100644
49af9ed
--- a/net/ipv4/inet_connection_sock.c
49af9ed
+++ b/net/ipv4/inet_connection_sock.c
49af9ed
@@ -328,6 +328,7 @@ int inet_csk_get_port(struct sock *sk, unsigned short snum)
49af9ed
 			tb->fastuid = uid;
49af9ed
 			tb->fast_rcv_saddr = sk->sk_rcv_saddr;
49af9ed
 			tb->fast_ipv6_only = ipv6_only_sock(sk);
49af9ed
+			tb->fast_sk_family = sk->sk_family;
49af9ed
 #if IS_ENABLED(CONFIG_IPV6)
49af9ed
 			tb->fast_v6_rcv_saddr = sk->sk_v6_rcv_saddr;
49af9ed
 #endif
49af9ed
@@ -354,6 +355,7 @@ int inet_csk_get_port(struct sock *sk, unsigned short snum)
49af9ed
 				tb->fastuid = uid;
49af9ed
 				tb->fast_rcv_saddr = sk->sk_rcv_saddr;
49af9ed
 				tb->fast_ipv6_only = ipv6_only_sock(sk);
49af9ed
+				tb->fast_sk_family = sk->sk_family;
49af9ed
 #if IS_ENABLED(CONFIG_IPV6)
49af9ed
 				tb->fast_v6_rcv_saddr = sk->sk_v6_rcv_saddr;
49af9ed
 #endif