diff options
author | Jouni Malinen <jkmaline@cc.hut.fi> | 2006-03-19 22:21:49 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2006-03-23 16:16:58 -0500 |
commit | 9320199957cebc39ccef372fa1fccf5ba3d3fd7d (patch) | |
tree | c4d89643eae57f819aa014eca6f4032d66e9ef5a /drivers/net/wireless/hostap | |
parent | 4f7ecdf0b1b8125fe190247beb0df652829e13cb (diff) |
[PATCH] hostap: Fix memory leak on PCI probe error path
The Coverity checker (CID: 659, 660) spotted this resource leak on
PCI probe error path. Free private data structure if pci_enable_device()
fails.
Signed-off-by: Jouni Malinen <jkmaline@cc.hut.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/hostap')
-rw-r--r-- | drivers/net/wireless/hostap/hostap_pci.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_plx.c | 9 |
2 files changed, 8 insertions, 5 deletions
diff --git a/drivers/net/wireless/hostap/hostap_pci.c b/drivers/net/wireless/hostap/hostap_pci.c index 2e85bdced2dd..194f07097581 100644 --- a/drivers/net/wireless/hostap/hostap_pci.c +++ b/drivers/net/wireless/hostap/hostap_pci.c | |||
@@ -307,7 +307,7 @@ static int prism2_pci_probe(struct pci_dev *pdev, | |||
307 | memset(hw_priv, 0, sizeof(*hw_priv)); | 307 | memset(hw_priv, 0, sizeof(*hw_priv)); |
308 | 308 | ||
309 | if (pci_enable_device(pdev)) | 309 | if (pci_enable_device(pdev)) |
310 | return -EIO; | 310 | goto err_out_free; |
311 | 311 | ||
312 | phymem = pci_resource_start(pdev, 0); | 312 | phymem = pci_resource_start(pdev, 0); |
313 | 313 | ||
@@ -368,6 +368,8 @@ static int prism2_pci_probe(struct pci_dev *pdev, | |||
368 | err_out_disable: | 368 | err_out_disable: |
369 | pci_disable_device(pdev); | 369 | pci_disable_device(pdev); |
370 | prism2_free_local_data(dev); | 370 | prism2_free_local_data(dev); |
371 | |||
372 | err_out_free: | ||
371 | kfree(hw_priv); | 373 | kfree(hw_priv); |
372 | 374 | ||
373 | return -ENODEV; | 375 | return -ENODEV; |
diff --git a/drivers/net/wireless/hostap/hostap_plx.c b/drivers/net/wireless/hostap/hostap_plx.c index e258517ac85d..edaaa943eb8f 100644 --- a/drivers/net/wireless/hostap/hostap_plx.c +++ b/drivers/net/wireless/hostap/hostap_plx.c | |||
@@ -452,7 +452,7 @@ static int prism2_plx_probe(struct pci_dev *pdev, | |||
452 | memset(hw_priv, 0, sizeof(*hw_priv)); | 452 | memset(hw_priv, 0, sizeof(*hw_priv)); |
453 | 453 | ||
454 | if (pci_enable_device(pdev)) | 454 | if (pci_enable_device(pdev)) |
455 | return -EIO; | 455 | goto err_out_free; |
456 | 456 | ||
457 | /* National Datacomm NCP130 based on TMD7160, not PLX9052. */ | 457 | /* National Datacomm NCP130 based on TMD7160, not PLX9052. */ |
458 | tmd7160 = (pdev->vendor == 0x15e8) && (pdev->device == 0x0131); | 458 | tmd7160 = (pdev->vendor == 0x15e8) && (pdev->device == 0x0131); |
@@ -567,9 +567,6 @@ static int prism2_plx_probe(struct pci_dev *pdev, | |||
567 | return hostap_hw_ready(dev); | 567 | return hostap_hw_ready(dev); |
568 | 568 | ||
569 | fail: | 569 | fail: |
570 | prism2_free_local_data(dev); | ||
571 | kfree(hw_priv); | ||
572 | |||
573 | if (irq_registered && dev) | 570 | if (irq_registered && dev) |
574 | free_irq(dev->irq, dev); | 571 | free_irq(dev->irq, dev); |
575 | 572 | ||
@@ -577,6 +574,10 @@ static int prism2_plx_probe(struct pci_dev *pdev, | |||
577 | iounmap(attr_mem); | 574 | iounmap(attr_mem); |
578 | 575 | ||
579 | pci_disable_device(pdev); | 576 | pci_disable_device(pdev); |
577 | prism2_free_local_data(dev); | ||
578 | |||
579 | err_out_free: | ||
580 | kfree(hw_priv); | ||
580 | 581 | ||
581 | return -ENODEV; | 582 | return -ENODEV; |
582 | } | 583 | } |