aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2017-09-22 23:33:18 -0400
committerDavid S. Miller <davem@davemloft.net>2017-09-22 23:33:18 -0400
commit4e683f499a15cd777d3cb51aaebe48d72334c852 (patch)
treed7ff42f5bdbdf81bdbdb2efa92674afcbf88fc4b
parent581fe0ea61584d88072527ae9fb9dcb9d1f2783e (diff)
parentfbed24bcc69d3e48c5402c371f19f5c7688871e5 (diff)
Merge branch 'net-fix-reuseaddr-regression'
Josef Bacik says: ==================== net: fix reuseaddr regression I introduced a regression when reworking the fastreuse port stuff that allows bind conflicts to occur once a reuseaddr successfully opens on an existing tb. The root cause is I reversed an if statement which caused us to set the tb as if there were no owners on the socket if there were, which obviously is not correct. Dave could you please queue these changes up for -stable, I've run them through the net tests and added another test to check for this problem specifically. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv4/inet_connection_sock.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index b9c64b40a83a..c039c937ba90 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -266,7 +266,7 @@ static inline int sk_reuseport_match(struct inet_bind_bucket *tb,
266#if IS_ENABLED(CONFIG_IPV6) 266#if IS_ENABLED(CONFIG_IPV6)
267 if (tb->fast_sk_family == AF_INET6) 267 if (tb->fast_sk_family == AF_INET6)
268 return ipv6_rcv_saddr_equal(&tb->fast_v6_rcv_saddr, 268 return ipv6_rcv_saddr_equal(&tb->fast_v6_rcv_saddr,
269 &sk->sk_v6_rcv_saddr, 269 inet6_rcv_saddr(sk),
270 tb->fast_rcv_saddr, 270 tb->fast_rcv_saddr,
271 sk->sk_rcv_saddr, 271 sk->sk_rcv_saddr,
272 tb->fast_ipv6_only, 272 tb->fast_ipv6_only,
@@ -321,13 +321,14 @@ tb_found:
321 goto fail_unlock; 321 goto fail_unlock;
322 } 322 }
323success: 323success:
324 if (!hlist_empty(&tb->owners)) { 324 if (hlist_empty(&tb->owners)) {
325 tb->fastreuse = reuse; 325 tb->fastreuse = reuse;
326 if (sk->sk_reuseport) { 326 if (sk->sk_reuseport) {
327 tb->fastreuseport = FASTREUSEPORT_ANY; 327 tb->fastreuseport = FASTREUSEPORT_ANY;
328 tb->fastuid = uid; 328 tb->fastuid = uid;
329 tb->fast_rcv_saddr = sk->sk_rcv_saddr; 329 tb->fast_rcv_saddr = sk->sk_rcv_saddr;
330 tb->fast_ipv6_only = ipv6_only_sock(sk); 330 tb->fast_ipv6_only = ipv6_only_sock(sk);
331 tb->fast_sk_family = sk->sk_family;
331#if IS_ENABLED(CONFIG_IPV6) 332#if IS_ENABLED(CONFIG_IPV6)
332 tb->fast_v6_rcv_saddr = sk->sk_v6_rcv_saddr; 333 tb->fast_v6_rcv_saddr = sk->sk_v6_rcv_saddr;
333#endif 334#endif
@@ -354,6 +355,7 @@ success:
354 tb->fastuid = uid; 355 tb->fastuid = uid;
355 tb->fast_rcv_saddr = sk->sk_rcv_saddr; 356 tb->fast_rcv_saddr = sk->sk_rcv_saddr;
356 tb->fast_ipv6_only = ipv6_only_sock(sk); 357 tb->fast_ipv6_only = ipv6_only_sock(sk);
358 tb->fast_sk_family = sk->sk_family;
357#if IS_ENABLED(CONFIG_IPV6) 359#if IS_ENABLED(CONFIG_IPV6)
358 tb->fast_v6_rcv_saddr = sk->sk_v6_rcv_saddr; 360 tb->fast_v6_rcv_saddr = sk->sk_v6_rcv_saddr;
359#endif 361#endif