aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2015-10-28 15:56:59 +0900
committerLorenzo Colitti <lorenzo@google.com>2015-10-28 16:03:08 +0900
commit70f767ae180a8b7ab0058145ed5375bc357a39a6 (patch)
tree1f2f4a8956bb427b3eca35086f29284dab659e22
parent7653f2e1b3c1d950b2b4df50df8025f604bfd6dc (diff)
downloadlinux-linaro-stable-70f767ae180a8b7ab0058145ed5375bc357a39a6.tar.gz
Don't kill IPv4 sockets when killing IPv6 sockets was requested.
c7c3ec4903d32c60423ee013d96e94602f66042c cherry-picked the tcp_nuke_addr ioctl, but omitted a check that ensures that a socket is an IPv6 socket. This makes it so that if we issue a SIOCKILLADDR on ::, it kills IPv4 sockets as well. This is because every IPv4 socket has an IPv6 source address (sk_v6_rcv_saddr) of ::. Thus, when we iterate over an IPv4 socket, and compare the source address of the socket to the source address in the ioctl, it matches the :: that was passed in, and we kill the socket. Change-Id: I736431a898e6ec91536536d352936a210aa10100
-rw-r--r--net/ipv4/tcp.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 1d4eef98ac65..a8c78ccf0f13 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -3221,6 +3221,8 @@ restart:
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
if (family == AF_INET6) {
struct in6_addr *s6;
+ if (!inet->pinet6)
+ continue;
s6 = &sk->sk_v6_rcv_saddr;
if (ipv6_addr_type(s6) == IPV6_ADDR_MAPPED)