Skip to content

Commit

Permalink
net/neighbour: fix crash at dumping device-agnostic proxy entries
Browse files Browse the repository at this point in the history
Proxy entries could have null pointer to net-device.

Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
Fixes: 84920c1 ("net: Allow ipv6 proxies and arp proxies be shown with iproute2")
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Konstantin Khlebnikov authored and David S. Miller committed Dec 3, 2015
1 parent cacc062 commit 6adc5fd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/core/neighbour.c
Original file line number Diff line number Diff line change
Expand Up @@ -2215,7 +2215,7 @@ static int pneigh_fill_info(struct sk_buff *skb, struct pneigh_entry *pn,
ndm->ndm_pad2 = 0;
ndm->ndm_flags = pn->flags | NTF_PROXY;
ndm->ndm_type = RTN_UNICAST;
ndm->ndm_ifindex = pn->dev->ifindex;
ndm->ndm_ifindex = pn->dev ? pn->dev->ifindex : 0;
ndm->ndm_state = NUD_NONE;

if (nla_put(skb, NDA_DST, tbl->key_len, pn->key))
Expand Down Expand Up @@ -2333,7 +2333,7 @@ static int pneigh_dump_table(struct neigh_table *tbl, struct sk_buff *skb,
if (h > s_h)
s_idx = 0;
for (n = tbl->phash_buckets[h], idx = 0; n; n = n->next) {
if (dev_net(n->dev) != net)
if (pneigh_net(n) != net)
continue;
if (idx < s_idx)
goto next;
Expand Down

0 comments on commit 6adc5fd

Please sign in to comment.