Commit e86d3703 authored by Patrick McHardy's avatar Patrick McHardy

[IPV4]: Fix free_netdev after failed alloc_netdev in ipgre_init

Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
parent b1eb7853
...@@ -1250,7 +1250,7 @@ static struct net_protocol ipgre_protocol = { ...@@ -1250,7 +1250,7 @@ static struct net_protocol ipgre_protocol = {
static int __init ipgre_init(void) static int __init ipgre_init(void)
{ {
int err = -EINVAL; int err;
printk(KERN_INFO "GRE over IPv4 tunneling driver\n"); printk(KERN_INFO "GRE over IPv4 tunneling driver\n");
...@@ -1263,18 +1263,19 @@ static int __init ipgre_init(void) ...@@ -1263,18 +1263,19 @@ static int __init ipgre_init(void)
ipgre_tunnel_setup); ipgre_tunnel_setup);
if (!ipgre_fb_tunnel_dev) { if (!ipgre_fb_tunnel_dev) {
err = -ENOMEM; err = -ENOMEM;
goto fail; goto err1;
} }
ipgre_fb_tunnel_dev->init = ipgre_fb_tunnel_init; ipgre_fb_tunnel_dev->init = ipgre_fb_tunnel_init;
if ((err = register_netdev(ipgre_fb_tunnel_dev))) if ((err = register_netdev(ipgre_fb_tunnel_dev)))
goto fail; goto err2;
out: out:
return err; return err;
fail: err2:
inet_del_protocol(&ipgre_protocol, IPPROTO_GRE);
free_netdev(ipgre_fb_tunnel_dev); free_netdev(ipgre_fb_tunnel_dev);
err1:
inet_del_protocol(&ipgre_protocol, IPPROTO_GRE);
goto out; goto out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment