diff options
author | Eric Dumazet <edumazet@google.com> | 2017-03-23 12:39:21 -0700 |
---|---|---|
committer | Jiri Slaby <jslaby@suse.cz> | 2017-05-09 08:19:45 +0200 |
commit | 1337a4ffe5bcf18979e516c3d65e5b110e7edc2a (patch) | |
tree | 311762d7b255516c3d36f778eb1718180f26efb1 | |
parent | 6e33ef16755a6936b6105868e12712ebdaebd7d0 (diff) | |
download | linux-stable-1337a4ffe5bcf18979e516c3d65e5b110e7edc2a.tar.gz linux-stable-1337a4ffe5bcf18979e516c3d65e5b110e7edc2a.tar.bz2 linux-stable-1337a4ffe5bcf18979e516c3d65e5b110e7edc2a.zip |
net: neigh: guard against NULL solicit() method
[ Upstream commit 48481c8fa16410ffa45939b13b6c53c2ca609e5f ]
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 <edumazet@google.com>
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/core/neighbour.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index 7957daa334cc..3a6a4f11e876 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); } |