Skip to content

Commit

Permalink
[PATCH] chelsio: free_netdev
Browse files Browse the repository at this point in the history
Network devices need to be free'd with free_netdev() not kfree()
otherwise the kernel will panic if an application has /sys/class/net/ethX/value
open and reads it.

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
  • Loading branch information
Stephen Hemminger authored and Jeff Garzik committed Dec 2, 2006
1 parent bac7e87 commit e487647
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions drivers/net/chelsio/cxgb2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1141,11 +1141,11 @@ static int __devinit init_one(struct pci_dev *pdev,
t1_free_sw_modules(adapter);
out_free_dev:
if (adapter) {
if (adapter->regs) iounmap(adapter->regs);
if (adapter->regs)
iounmap(adapter->regs);
for (i = bi->port_number - 1; i >= 0; --i)
if (adapter->port[i].dev) {
kfree(adapter->port[i].dev);
}
if (adapter->port[i].dev)
free_netdev(adapter->port[i].dev);
}
pci_release_regions(pdev);
out_disable_pdev:
Expand Down Expand Up @@ -1175,9 +1175,9 @@ static void __devexit remove_one(struct pci_dev *pdev)
t1_free_sw_modules(adapter);
iounmap(adapter->regs);
while (--i >= 0)
if (adapter->port[i].dev) {
kfree(adapter->port[i].dev);
}
if (adapter->port[i].dev)
free_netdev(adapter->port[i].dev);

pci_release_regions(pdev);
pci_disable_device(pdev);
pci_set_drvdata(pdev, NULL);
Expand Down

0 comments on commit e487647

Please sign in to comment.