Hi all,
this trivial patch fixes possible kernel crash when using GRE tunnels in
2.6.0-test. The problem was that "dev->init" wasn't set before
register_netdevice() call and so the initialization function was never
called. Consequently some fields in the tunnel structure were not
initialized what finally led to a kernel crash upon receiving the first
packet over the GRE tunnel.
Michal Ludvig
--
* A mouse is a device used to point at the xterm you want to type in.
* Personal homepage - http://www.logix.cz/~mic
# Patch for http://bugme.osdl.org/show_bug.cgi?id=1130
# Applies cleanly to 2.6.0-test5
# Michal Ludvig <mludvig@xxxxxxx>
--- linux-2.6.0-test5-clean/net/ipv4/ip_gre.c 2003-09-08 21:50:18.000000000
+0200
+++ linux-2.6.0-test5/net/ipv4/ip_gre.c 2003-09-23 16:50:09.000000000 +0200
@@ -271,13 +271,17 @@ static struct ip_tunnel * ipgre_tunnel_l
}
dev = alloc_netdev(sizeof(*t), name, ipgre_tunnel_setup);
+ if (!dev)
+ return NULL;
+
+ dev->init = ipgre_tunnel_init;
+
if (register_netdevice(dev) < 0) {
kfree(dev);
goto failed;
}
nt = dev->priv;
- dev->init = ipgre_tunnel_init;
nt->parms = *parms;
dev_hold(dev);
|