netdev
[Top] [All Lists]

[PATCH 2.6 4/7]: Fix free_netdev after failed alloc_netdev in ipip_init

To: "David S. Miller" <davem@xxxxxxxxxx>
Subject: [PATCH 2.6 4/7]: Fix free_netdev after failed alloc_netdev in ipip_init
From: Patrick McHardy <kaber@xxxxxxxxx>
Date: Sun, 03 Oct 2004 23:13:06 +0200
Cc: netdev@xxxxxxxxxxx
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040413 Debian/1.6-5
Same problem as in ip_gre:
Passing a NULL-ptr to free_netdev is wrong.


# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/10/03 20:41:00+02:00 kaber@xxxxxxxxxxxx 
#   [IPV4]: Fix free_netdev after failed alloc_netdev in ipip_init
#   
#   Signed-off-by: Patrick McHardy <kaber@xxxxxxxxx>
# 
# net/ipv4/ipip.c
#   2004/10/03 20:40:18+02:00 kaber@xxxxxxxxxxxx +5 -4
#   [IPV4]: Fix free_netdev after failed alloc_netdev in ipip_init
#   
#   Signed-off-by: Patrick McHardy <kaber@xxxxxxxxx>
# 
diff -Nru a/net/ipv4/ipip.c b/net/ipv4/ipip.c
--- a/net/ipv4/ipip.c   2004-10-03 22:20:28 +02:00
+++ b/net/ipv4/ipip.c   2004-10-03 22:20:28 +02:00
@@ -876,18 +876,19 @@
                                           ipip_tunnel_setup);
        if (!ipip_fb_tunnel_dev) {
                err = -ENOMEM;
-               goto fail;
+               goto err1;
        }
 
        ipip_fb_tunnel_dev->init = ipip_fb_tunnel_init;
 
        if ((err = register_netdev(ipip_fb_tunnel_dev)))
-           goto fail;
+               goto err2;
  out:
        return err;
- fail:
-       xfrm4_tunnel_deregister(&ipip_handler);
+ err2:
        free_netdev(ipip_fb_tunnel_dev);
+ err1:
+       xfrm4_tunnel_deregister(&ipip_handler);
        goto out;
 }
 
<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH 2.6 4/7]: Fix free_netdev after failed alloc_netdev in ipip_init, Patrick McHardy <=