Skip to contentSkip to conversation

: Fix free_netdev after failed alloc_netdev in sit_init

PATCH In review Patrick McHardy 1 participant 1 message Oct 3, 2004

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

PATCH 6/7 : Fix free_netdev after failed alloc_netdev in sit_init

Same problem as in ip_gre.c and ipip.c:
Passing a NULL-ptr to free_netdev is wrong.

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/10/03 20:43:32+02:00 [email protected]
# [IPV6]: Fix free_netdev after failed alloc_netdev in sit_init
#
# Signed-off-by: Patrick McHardy <[email protected]>
#

# net/ipv6/sit.c
#   2004/10/03 20:43:09+02:00 [email protected] +5 -4
#   [IPV6]: Fix free_netdev after failed alloc_netdev in sit_init
#   
#   Signed-off-by: Patrick McHardy <[email protected]>
# 
diff -Nru a/net/ipv6/sit.c b/net/ipv6/sit.c
--- a/net/ipv6/sit.c	2004-10-03 22:21:06 +02:00
+++ b/net/ipv6/sit.c	2004-10-03 22:21:06 +02:00
@@ -814,18 +814,19 @@
 					   ipip6_tunnel_setup);
 	if (!ipip6_fb_tunnel_dev) {
 		err = -ENOMEM;
-		goto fail;
+		goto err1;
 	}

ipip6_fb_tunnel_dev->init = ipip6_fb_tunnel_init;

if ((err = register_netdev(ipip6_fb_tunnel_dev)))
- goto fail;
+ goto err2;

out:
return err;
- fail:
- inet_del_protocol(&sit_protocol, IPPROTO_IPV6);
+ err2:
free_netdev(ipip6_fb_tunnel_dev);
+ err1:
+ inet_del_protocol(&sit_protocol, IPPROTO_IPV6);
goto out;
}