net: fix iterating over hashtable in tcp_nuke_addr()
authorDmitry Torokhov <dtor@google.com>
Fri, 10 Jul 2015 00:17:57 +0000 (17:17 -0700)
committerJohn Stultz <john.stultz@linaro.org>
Tue, 16 Feb 2016 21:51:16 +0000 (13:51 -0800)
The actual size of the tcp hashinfo table is tcp_hashinfo.ehash_mask + 1
so we need to adjust the loop accordingly to get the sockets hashed into
the last bucket.

Change-Id: I796b3c7b4a1a7fa35fba9e5192a4a403eb6e17de
Signed-off-by: Dmitry Torokhov <dtor@google.com>
net/ipv4/tcp.c

index f94bc2cf50d32863eba17dbeb663023b88f516c6..c8cfe784c79a73070bf4d7a94d0b8ce0bb3bcdad 100644 (file)
@@ -3231,7 +3231,7 @@ int tcp_nuke_addr(struct net *net, struct sockaddr *addr)
                return -EAFNOSUPPORT;
        }
 
-       for (bucket = 0; bucket < tcp_hashinfo.ehash_mask; bucket++) {
+       for (bucket = 0; bucket <= tcp_hashinfo.ehash_mask; bucket++) {
                struct hlist_nulls_node *node;
                struct sock *sk;
                spinlock_t *lock = inet_ehash_lockp(&tcp_hashinfo, bucket);