Skip to contentSkip to conversation

ip_gre.c in 2.6.0-test5

PATCH Applied Michal Ludvig 2 participants 2 messages Sep 24, 2003 – Sep 25, 2003

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ip_gre.c in 2.6.0-test5

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

Signature · 2 lines
* 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 <[email protected]>

net/ipv4/ip_gre.c +5 -1
@@ -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);
#1 lore raw
Quoted 6 lines · On Wed, 24 Sep 2003 10:34:58 +0200 Michal Ludvig <[email protected]> wrote:

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.

Applied, thanks Michal.