From: Eric Dumazet Date: Thu, 23 Mar 2017 19:39:21 +0000 (-0700) Subject: net: neigh: guard against NULL solicit() method X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4d1b81c2669bc6ab4ff24d649c876469aba412a9;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git net: neigh: guard against NULL solicit() method commit 48481c8fa16410ffa45939b13b6c53c2ca609e5f upstream. Dmitry posted a nice reproducer of a bug triggering in neigh_probe() when dereferencing a NULL neigh->ops->solicit method. This can happen for arp_direct_ops/ndisc_direct_ops and similar, which can be used for NUD_NOARP neighbours (created when dev->header_ops is NULL). Admin can then force changing nud_state to some other state that would fire neigh timer. Signed-off-by: Eric Dumazet Reported-by: Dmitry Vyukov Signed-off-by: David S. Miller Signed-off-by: Willy Tarreau --- diff --git a/net/core/neighbour.c b/net/core/neighbour.c index b49e8bafab17..fb82e8a5b006 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c @@ -872,7 +872,8 @@ static void neigh_probe(struct neighbour *neigh) if (skb) skb = skb_copy(skb, GFP_ATOMIC); write_unlock(&neigh->lock); - neigh->ops->solicit(neigh, skb); + if (neigh->ops->solicit) + neigh->ops->solicit(neigh, skb); atomic_inc(&neigh->probes); kfree_skb(skb); }