]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: slicoss: fix use-after-free bug in slic_entry_remove
authorDavid Matlack <dmatlack@google.com>
Tue, 6 May 2014 04:02:37 +0000 (21:02 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 May 2014 11:08:34 +0000 (20:08 +0900)
This patch fixes a use-after-free bug that causes a null pointer
dereference in slic_entry_halt.

Since unregister_netdev() will ultimately call slic_entry_halt (the
net_device ndo_stop() virtual function for this device), we should
call it before freeing the memory used by slic_entry_halt.

Signed-off-by: David Matlack <dmatlack@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/slicoss/slicoss.c

index fde0ff97f5fb2054ce2497f9e120c0ee72d7c51f..3010501120d24db3e2cda7b93dab4ba61611849e 100644 (file)
@@ -2525,9 +2525,10 @@ static void slic_entry_remove(struct pci_dev *pcidev)
        struct sliccard *card;
        struct mcast_address *mcaddr, *mlist;
 
+       unregister_netdev(dev);
+
        slic_adapter_freeresources(adapter);
        slic_unmap_mmio_space(adapter);
-       unregister_netdev(dev);
 
        /* free multicast addresses */
        mlist = adapter->mcastaddrs;