| From f0508cfc6b8462f754b0b3c2459341ac7fbf2a63 Mon Sep 17 00:00:00 2001 |
| From: Eric Dumazet <edumazet@google.com> |
| Date: Thu, 23 Mar 2017 12:39:21 -0700 |
| Subject: [PATCH] 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 <edumazet@google.com> |
| Reported-by: Dmitry Vyukov <dvyukov@google.com> |
| Signed-off-by: David S. Miller <davem@davemloft.net> |
| Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> |
| |
| diff --git a/net/core/neighbour.c b/net/core/neighbour.c |
| index 41fba8fc16c6..89fab3564a84 100644 |
| --- a/net/core/neighbour.c |
| +++ b/net/core/neighbour.c |
| @@ -859,7 +859,8 @@ static void neigh_probe(struct neighbour *neigh) |
| if (skb) |
| skb = skb_clone(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); |
| } |
| -- |
| 2.12.0 |
| |