netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ipv4: gre: Fix null pointer dereference in gre_cisco_err()
@ 2014-03-24  7:34 Wei Zhang
  2014-03-24  7:49 ` wei zhang
  2014-03-24 19:14 ` [PATCH] " David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Wei Zhang @ 2014-03-24  7:34 UTC (permalink / raw)
  To: xeb, davem, kuznet, jmorris, yoshfuji, kaber
  Cc: netdev, linux-kernel, Wei Zhang

When use the gre vport, openvswitch register a gre_cisco_protocol but
does not supply a err_handler with it. The gre_cisco_err() call the
err_handler without existence check, cause the kernel crash.

This patch base on v3.14-rc7. But the bug affect all kernel newer than
3.11!

Signed-off-by: Wei Zhang <asuka.com@163.com>
---
 net/ipv4/gre_demux.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/ipv4/gre_demux.c b/net/ipv4/gre_demux.c
index 1863422..56b0d67 100644
--- a/net/ipv4/gre_demux.c
+++ b/net/ipv4/gre_demux.c
@@ -250,7 +250,7 @@ static void gre_cisco_err(struct sk_buff *skb, u32 info)
 		struct gre_cisco_protocol *proto;
 
 		proto = rcu_dereference(gre_cisco_proto_list[i]);
-		if (!proto)
+		if (!proto || !proto->err_handler)
 			continue;
 
 		if (proto->err_handler(skb, info, &tpi) == PACKET_RCVD)
-- 
1.7.1

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

end of thread, other threads:[~2014-03-25  9:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-24  7:34 [PATCH] ipv4: gre: Fix null pointer dereference in gre_cisco_err() Wei Zhang
2014-03-24  7:49 ` wei zhang
2014-03-24 19:14 ` [PATCH] " David Miller
2014-03-25  8:56   ` wei zhang

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).