staging: slicoss: use free_netdev(netdev) instead of kfree()
authorVasiliy Kulikov <segooon@gmail.com>
Tue, 28 Sep 2010 17:08:08 +0000 (21:08 +0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 30 Sep 2010 11:14:21 +0000 (04:14 -0700)
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)

Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
Acked-by: Denis Kirjanov <dkirjanov@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/slicoss/slicoss.c

index 58ff1233270ca6f0e02eb026b32be6794022f47c..18f11039bb5f368a45bc4937b934aeab161eb5d4 100644 (file)
@@ -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);
 }