Commit 6adc5fd6 authored by Konstantin Khlebnikov's avatar Konstantin Khlebnikov Committed by David S. Miller

net/neighbour: fix crash at dumping device-agnostic proxy entries

Proxy entries could have null pointer to net-device.
Signed-off-by: default avatarKonstantin Khlebnikov <koct9i@gmail.com>
Fixes: 84920c14 ("net: Allow ipv6 proxies and arp proxies be shown with iproute2")
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cacc0621
...@@ -2215,7 +2215,7 @@ static int pneigh_fill_info(struct sk_buff *skb, struct pneigh_entry *pn, ...@@ -2215,7 +2215,7 @@ static int pneigh_fill_info(struct sk_buff *skb, struct pneigh_entry *pn,
ndm->ndm_pad2 = 0; ndm->ndm_pad2 = 0;
ndm->ndm_flags = pn->flags | NTF_PROXY; ndm->ndm_flags = pn->flags | NTF_PROXY;
ndm->ndm_type = RTN_UNICAST; 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; ndm->ndm_state = NUD_NONE;
if (nla_put(skb, NDA_DST, tbl->key_len, pn->key)) if (nla_put(skb, NDA_DST, tbl->key_len, pn->key))
...@@ -2333,7 +2333,7 @@ static int pneigh_dump_table(struct neigh_table *tbl, struct sk_buff *skb, ...@@ -2333,7 +2333,7 @@ static int pneigh_dump_table(struct neigh_table *tbl, struct sk_buff *skb,
if (h > s_h) if (h > s_h)
s_idx = 0; s_idx = 0;
for (n = tbl->phash_buckets[h], idx = 0; n; n = n->next) { for (n = tbl->phash_buckets[h], idx = 0; n; n = n->next) {
if (dev_net(n->dev) != net) if (pneigh_net(n) != net)
continue; continue;
if (idx < s_idx) if (idx < s_idx)
goto next; goto next;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment