Message ID | 1593939229-8191-1-git-send-email-martinvarghesenokia@gmail.com |
---|---|
State | Accepted |
Delegated to: | David Miller |
Headers | show |
Series | [net] net: Added pointer check for dst->ops->neigh_lookup in dst_neigh_lookup_skb | expand |
From: Martin Varghese <martinvarghesenokia@gmail.com> Date: Sun, 5 Jul 2020 14:23:49 +0530 > From: Martin Varghese <martin.varghese@nokia.com> > > The packets from tunnel devices (eg bareudp) may have only > metadata in the dst pointer of skb. Hence a pointer check of > neigh_lookup is needed in dst_neigh_lookup_skb > > Kernel crashes when packets from bareudp device is processed in > the kernel neighbour subsytem. ... > Fixes: aaa0c23cb901 ("Fix dst_neigh_lookup/dst_neigh_lookup_skb return value handling bug") > Signed-off-by: Martin Varghese <martin.varghese@nokia.com> Applied and queued up for -stable, thanks.
diff --git a/include/net/dst.h b/include/net/dst.h index 07adfac..852d8fb 100644 --- a/include/net/dst.h +++ b/include/net/dst.h @@ -400,7 +400,15 @@ static inline struct neighbour *dst_neigh_lookup(const struct dst_entry *dst, co static inline struct neighbour *dst_neigh_lookup_skb(const struct dst_entry *dst, struct sk_buff *skb) { - struct neighbour *n = dst->ops->neigh_lookup(dst, skb, NULL); + struct neighbour *n = NULL; + + /* The packets from tunnel devices (eg bareudp) may have only + * metadata in the dst pointer of skb. Hence a pointer check of + * neigh_lookup is needed. + */ + if (dst->ops->neigh_lookup) + n = dst->ops->neigh_lookup(dst, skb, NULL); + return IS_ERR(n) ? NULL : n; }