diff options
author | Eric Dumazet <edumazet@google.com> | 2017-03-23 15:39:21 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-05-03 11:36:34 -0400 |
commit | 4f99161f2ec5f9ec1570a478cb1395e45034d8f3 (patch) | |
tree | 000346c0976422d535f2bc426976de5e943e1a86 /net | |
parent | 512d211207df2a6e7ef0fa5c402f0f9f39b1fe8d (diff) |
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to '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 9901e5b75a05..f45f6198851f 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -859,7 +859,8 @@ static void neigh_probe(struct neighbour *neigh) | |||
859 | if (skb) | 859 | if (skb) |
860 | skb = skb_clone(skb, GFP_ATOMIC); | 860 | skb = skb_clone(skb, GFP_ATOMIC); |
861 | write_unlock(&neigh->lock); | 861 | write_unlock(&neigh->lock); |
862 | neigh->ops->solicit(neigh, skb); | 862 | if (neigh->ops->solicit) |
863 | neigh->ops->solicit(neigh, skb); | ||
863 | atomic_inc(&neigh->probes); | 864 | atomic_inc(&neigh->probes); |
864 | kfree_skb(skb); | 865 | kfree_skb(skb); |
865 | } | 866 | } |