]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.4/net-ipv6-display-all-addresses-in-output-of-proc-net-if_inet6.patch
Linux 4.9.135
[thirdparty/kernel/stable-queue.git] / queue-4.4 / net-ipv6-display-all-addresses-in-output-of-proc-net-if_inet6.patch
1 From foo@baz Tue Oct 16 16:47:53 CEST 2018
2 From: Jeff Barnhill <0xeffeff@gmail.com>
3 Date: Fri, 21 Sep 2018 00:45:27 +0000
4 Subject: net/ipv6: Display all addresses in output of /proc/net/if_inet6
5
6 From: Jeff Barnhill <0xeffeff@gmail.com>
7
8 [ Upstream commit 86f9bd1ff61c413a2a251fa736463295e4e24733 ]
9
10 The backend handling for /proc/net/if_inet6 in addrconf.c doesn't properly
11 handle starting/stopping the iteration. The problem is that at some point
12 during the iteration, an overflow is detected and the process is
13 subsequently stopped. The item being shown via seq_printf() when the
14 overflow occurs is not actually shown, though. When start() is
15 subsequently called to resume iterating, it returns the next item, and
16 thus the item that was being processed when the overflow occurred never
17 gets printed.
18
19 Alter the meaning of the private data member "offset". Currently, when it
20 is not 0 (which only happens at the very beginning), "offset" represents
21 the next hlist item to be printed. After this change, "offset" always
22 represents the current item.
23
24 This is also consistent with the private data member "bucket", which
25 represents the current bucket, and also the use of "pos" as defined in
26 seq_file.txt:
27 The pos passed to start() will always be either zero, or the most
28 recent pos used in the previous session.
29
30 Signed-off-by: Jeff Barnhill <0xeffeff@gmail.com>
31 Signed-off-by: David S. Miller <davem@davemloft.net>
32 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
33 ---
34 net/ipv6/addrconf.c | 4 +---
35 1 file changed, 1 insertion(+), 3 deletions(-)
36
37 --- a/net/ipv6/addrconf.c
38 +++ b/net/ipv6/addrconf.c
39 @@ -3786,7 +3786,6 @@ static struct inet6_ifaddr *if6_get_firs
40 p++;
41 continue;
42 }
43 - state->offset++;
44 return ifa;
45 }
46
47 @@ -3810,13 +3809,12 @@ static struct inet6_ifaddr *if6_get_next
48 return ifa;
49 }
50
51 + state->offset = 0;
52 while (++state->bucket < IN6_ADDR_HSIZE) {
53 - state->offset = 0;
54 hlist_for_each_entry_rcu_bh(ifa,
55 &inet6_addr_lst[state->bucket], addr_lst) {
56 if (!net_eq(dev_net(ifa->idev->dev), net))
57 continue;
58 - state->offset++;
59 return ifa;
60 }
61 }