[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1316497936-16901-1-git-send-email-rongqing.li@windriver.com>
Date:	Tue, 20 Sep 2011 13:52:16 +0800
From:	<rongqing.li@...driver.com>
To:	<netdev@...r.kernel.org>, <eric.dumazet@...il.com>,
	<stable@...nel.org>
Subject: [PATCH net-next] ipv6: fix a possible double free
From: Roy.Li <rongqing.li@...driver.com>
When calling snmp6_alloc_dev fails, the snmp6 relevant memory
are freed by snmp6_alloc_dev. Calling in6_dev_finish_destroy
will free these memory twice.
Double free will lead that undefined behavior occurs.
Signed-off-by: Roy.Li <rongqing.li@...driver.com>
Acked-by: Eric Dumazet <eric.dumazet@...il.com>
---
 net/ipv6/addrconf.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index f012ebd..12368c5 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -374,8 +374,8 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev)
 			"%s(): cannot allocate memory for statistics; dev=%s.\n",
 			__func__, dev->name));
 		neigh_parms_release(&nd_tbl, ndev->nd_parms);
-		ndev->dead = 1;
-		in6_dev_finish_destroy(ndev);
+		dev_put(dev);
+		kfree(ndev);
 		return NULL;
 	}
 
-- 
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists