Skip to content

Commit 4ba4c56

Browse files
dsaherndavem330
authored andcommitted
net/ipv6: Fix index counter for unicast addresses in in6_dump_addrs
The loop wants to skip previously dumped addresses, so loops until current index >= saved index. If the message fills it wants to save the index for the next address to dump - ie., the one that did not fit in the current message. Currently, it is incrementing the index counter before comparing to the saved index, and then the saved index is off by 1 - it assumes the current address is going to fit in the message. Change the index handling to increment only after a succesful dump. Fixes: 502a2ff ("ipv6: convert idev_list to list macros") Signed-off-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent d55bef5 commit 4ba4c56

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

net/ipv6/addrconf.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4928,8 +4928,8 @@ static int in6_dump_addrs(struct inet6_dev *idev, struct sk_buff *skb,
49284928

49294929
/* unicast address incl. temp addr */
49304930
list_for_each_entry(ifa, &idev->addr_list, if_list) {
4931-
if (++ip_idx < s_ip_idx)
4932-
continue;
4931+
if (ip_idx < s_ip_idx)
4932+
goto next;
49334933
err = inet6_fill_ifaddr(skb, ifa,
49344934
NETLINK_CB(cb->skb).portid,
49354935
cb->nlh->nlmsg_seq,
@@ -4938,6 +4938,8 @@ static int in6_dump_addrs(struct inet6_dev *idev, struct sk_buff *skb,
49384938
if (err < 0)
49394939
break;
49404940
nl_dump_check_consistent(cb, nlmsg_hdr(skb));
4941+
next:
4942+
ip_idx++;
49414943
}
49424944
break;
49434945
}

0 commit comments

Comments
 (0)