From: Konstantin Khlebnikov Date: Mon, 30 Nov 2015 22:14:48 +0000 (+0300) Subject: net/neighbour: fix crash at dumping device-agnostic proxy entries X-Git-Tag: v4.1.12-92~201^2~31 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=3acd81a7dd4de617d8473b5a03062ee1e50bb647;p=users%2Fjedix%2Flinux-maple.git net/neighbour: fix crash at dumping device-agnostic proxy entries Orabug: 22623860 [ Upstream commit 6adc5fd6a142c6e2c80574c1db0c7c17dedaa42e ] Proxy entries could have null pointer to net-device. Signed-off-by: Konstantin Khlebnikov Fixes: 84920c1420e2 ("net: Allow ipv6 proxies and arp proxies be shown with iproute2") Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman (cherry picked from commit e08ca7be16f178988ccf95f96edf6eff5d89bb0a) Signed-off-by: Dan Duval --- diff --git a/net/core/neighbour.c b/net/core/neighbour.c index 2237c1b3cdd20..d6e8cfcb6f7cd 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c @@ -2207,7 +2207,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)) @@ -2282,7 +2282,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;