Skip to contentSkip to conversation

sgiseeq: use free_netdev(netdev) instead of kfree()

PATCH Applied Vasiliy Kulikov 2 participants 2 messages Sep 26, 2010 – Sep 27, 2010

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

PATCH 3/9 sgiseeq: use free_netdev(netdev) instead of kfree()

Freeing netdev without free_netdev() leads to net, tx leaks. I might lead to dereferencing freed pointer.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

@@
struct net_device* dev;
@@

-kfree(dev)
+free_netdev(dev)

---
 drivers/net/sgiseeq.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/sgiseeq.c +1 -1
index cc4bd8c..9265315 100644
@@ -804,7 +804,7 @@ static int __devinit sgiseeq_probe(struct platform_device *pdev)
 err_out_free_page:
 	free_page((unsigned long) sp->srings);
 err_out_free_dev:
-	kfree(dev);
+	free_netdev(dev);
 
 err_out:
 	return err;
Signature · 1 line
1.7.0.4
maintainer Applied
#1 lore raw

From: Vasiliy Kulikov <[email protected]>
Date: Sun, 26 Sep 2010 13:58:06 +0400

Review

Quoted 12 lines

Freeing netdev without free_netdev() leads to net, tx leaks. I might lead to dereferencing freed pointer.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

@@
struct net_device* dev;
@@

(quoted diff) +1 -1
-kfree(dev)
+free_netdev(dev)

Applied.