netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net/core: fixing dst_neigh_lookup/dst_neigh_lookup_skb caused kernel panic
@ 2013-03-13  4:00 Zhouyi Zhou
  2013-03-13 14:33 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Zhouyi Zhou @ 2013-03-13  4:00 UTC (permalink / raw)
  To: netdev; +Cc: stable, trivial

 when neighbour table is full, dst_neigh_lookup/dst_neigh_lookup_skb
will return -ENOBUFS which
is absolutely non zero, while all the code in kernel which use above
functions  assume failure only
on zero return (I did a grep), which will cause kernel panic. (for
example: https://bugzilla.kernel.org/show_bug.cgi?id=54731)

  This patch corrects above error with smallest changes to kernel source code.
Signed-off-by: Zhouyi Zhou <zhouzhouyi@gmail.com>

diff --git a/include/net/dst.h b/include/net/dst.h
index 853cda1..d594f8b 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -413,13 +413,15 @@ static inline int dst_neigh_output(struct
dst_entry *dst, struct neighbour *n,

 static inline struct neighbour *dst_neigh_lookup(const struct
dst_entry *dst, const void *daddr)
 {
-       return dst->ops->neigh_lookup(dst, NULL, daddr);
+       struct neighbour *n = dst->ops->neigh_lookup(dst, NULL, daddr);
+       return IS_ERR(n) ? NULL : n;
 }

 static inline struct neighbour *dst_neigh_lookup_skb(const struct
dst_entry *dst,
                                                     struct sk_buff *skb)
 {
-       return dst->ops->neigh_lookup(dst, skb, NULL);
+       struct neighbour *n = dst->ops->neigh_lookup(dst, skb, NULL);
+       return IS_ERR(n) ? NULL : n;
 }

 static inline void dst_link_failure(struct sk_buff *skb)

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net/core: fixing dst_neigh_lookup/dst_neigh_lookup_skb caused kernel panic
  2013-03-13  4:00 [PATCH] net/core: fixing dst_neigh_lookup/dst_neigh_lookup_skb caused kernel panic Zhouyi Zhou
@ 2013-03-13 14:33 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2013-03-13 14:33 UTC (permalink / raw)
  To: zhouzhouyi; +Cc: netdev, stable, trivial

From: Zhouyi Zhou <zhouzhouyi@gmail.com>
Date: Wed, 13 Mar 2013 12:00:34 +0800

>  when neighbour table is full, dst_neigh_lookup/dst_neigh_lookup_skb
> will return -ENOBUFS which
> is absolutely non zero, while all the code in kernel which use above
> functions  assume failure only
> on zero return (I did a grep), which will cause kernel panic. (for
> example: https://bugzilla.kernel.org/show_bug.cgi?id=54731)
> 
>   This patch corrects above error with smallest changes to kernel source code.
> Signed-off-by: Zhouyi Zhou <zhouzhouyi@gmail.com>

Your patch was corrupted by your email client.

Fix this, and only resend this patch once you are able to send a test
patch to yourself and cleanly apply the patch you receive.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-03-13 14:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-13  4:00 [PATCH] net/core: fixing dst_neigh_lookup/dst_neigh_lookup_skb caused kernel panic Zhouyi Zhou
2013-03-13 14:33 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).