diff options
author | Tony Battersby <tonyb@cybernetics.com> | 2009-01-08 12:52:32 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2009-03-12 13:58:15 -0400 |
commit | d3ce65d12668ef1e3a164d48e04c59228d5ecf7b (patch) | |
tree | 30ff47103eaec0ecccb562ea51c4ecd715405d3f /drivers/scsi/sym53c8xx_2 | |
parent | 2cf22be045ee1b29f9ce5cf4f4552811bb24916a (diff) |
[SCSI] sym53c8xx: fix shost use-after-free and memory leak
This patch fixes two bugs:
1) rmmod sym53c8xx uses shost after freeing it with
scsi_put_host(shost).
2) insmod sym53c8xx doesn't call scsi_put_host(shost) if
scsi_add_host() fails, causing a memory leak on the error path.
Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/sym53c8xx_2')
-rw-r--r-- | drivers/scsi/sym53c8xx_2/sym_glue.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c index f4e6cde1fd0d..ff5be958d3d3 100644 --- a/drivers/scsi/sym53c8xx_2/sym_glue.c +++ b/drivers/scsi/sym53c8xx_2/sym_glue.c | |||
@@ -1660,6 +1660,7 @@ static int sym_detach(struct Scsi_Host *shost, struct pci_dev *pdev) | |||
1660 | OUTB(np, nc_istat, 0); | 1660 | OUTB(np, nc_istat, 0); |
1661 | 1661 | ||
1662 | sym_free_resources(np, pdev); | 1662 | sym_free_resources(np, pdev); |
1663 | scsi_host_put(shost); | ||
1663 | 1664 | ||
1664 | return 1; | 1665 | return 1; |
1665 | } | 1666 | } |
@@ -1749,7 +1750,6 @@ static void sym2_remove(struct pci_dev *pdev) | |||
1749 | struct Scsi_Host *shost = pci_get_drvdata(pdev); | 1750 | struct Scsi_Host *shost = pci_get_drvdata(pdev); |
1750 | 1751 | ||
1751 | scsi_remove_host(shost); | 1752 | scsi_remove_host(shost); |
1752 | scsi_host_put(shost); | ||
1753 | sym_detach(shost, pdev); | 1753 | sym_detach(shost, pdev); |
1754 | pci_release_regions(pdev); | 1754 | pci_release_regions(pdev); |
1755 | pci_disable_device(pdev); | 1755 | pci_disable_device(pdev); |