inet: don't use sk_v6_rcv_saddr directly
authorJosef Bacik <jbacik@fb.com>
Thu, 19 Jan 2017 22:47:46 +0000 (17:47 -0500)
committerDavid S. Miller <davem@davemloft.net>
Fri, 20 Jan 2017 19:35:51 +0000 (14:35 -0500)
When comparing two sockets we need to use inet6_rcv_saddr so we get a NULL
sk_v6_rcv_saddr if the socket isn't AF_INET6, otherwise our comparison function
can be wrong.

Fixes: 637bc8b ("inet: reset tb->fastreuseport when adding a reuseport sk")
Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/inet_connection_sock.c

index c7f7c53353691070813eeb7ece86d1826f408fd5..b4d5980ade3b584c444d0f0c6523f03a2f71f884 100644 (file)
@@ -99,7 +99,7 @@ int inet_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2,
 #if IS_ENABLED(CONFIG_IPV6)
        if (sk->sk_family == AF_INET6)
                return ipv6_rcv_saddr_equal(&sk->sk_v6_rcv_saddr,
-                                           &sk2->sk_v6_rcv_saddr,
+                                           inet6_rcv_saddr(sk2),
                                            sk->sk_rcv_saddr,
                                            sk2->sk_rcv_saddr,
                                            ipv6_only_sock(sk),