Skip to contentSkip to conversation

staging: slicoss: use free_netdev(netdev) instead of kfree()

PATCH In review Vasiliy Kulikov 2 participants 2 messages Sep 28, 2010

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

PATCH 8/9 staging: slicoss: 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)

---
Compile tested.

 drivers/staging/slicoss/slicoss.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/slicoss/slicoss.c +1 -1
index 58ff123..18f1103 100644
@@ -3233,7 +3233,7 @@ static void __devexit slic_entry_remove(struct pci_dev *pcidev)
 		slic_global.num_slic_cards--;
 		slic_card_cleanup(card);
 	}
-	kfree(dev);
+	free_netdev(dev);
 	pci_release_regions(pcidev);
 }
 
Signature · 1 line
1.7.0.4
Acked-by on v1 8/9
#1 lore raw
Quoted 25 lines · Vasiliy Kulikov

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)

---
Compile tested.

 drivers/staging/slicoss/slicoss.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/slicoss/slicoss.c +0 -0
index 58ff123..18f1103 100644

drivers/staging/slicoss/slicoss.c static void __devexit slic_entry_remove(struct pci_dev *pcidev) · line 3239

Quoted 8 lines
drivers/staging/slicoss/slicoss.c +1 -1
@@ -3233,7 +3233,7 @@ static void __devexit slic_entry_remove(struct pci_dev *pcidev)
 		slic_global.num_slic_cards--;
 		slic_card_cleanup(card);
 	}
-	kfree(dev);
+	free_netdev(dev);
 	pci_release_regions(pcidev);
 }