[PATCH] sym53c8xx: fix shost use-after-free and memory leak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxx>
---
--- linux-2.6.28-rc8/drivers/scsi/sym53c8xx_2/sym_glue.c.orig	2008-12-16 14:18:46.000000000 -0500
+++ linux-2.6.28-rc8/drivers/scsi/sym53c8xx_2/sym_glue.c	2008-12-16 14:19:41.000000000 -0500
@@ -1660,6 +1660,7 @@ static int sym_detach(struct Scsi_Host *
 	OUTB(np, nc_istat, 0);
 
 	sym_free_resources(np, pdev);
+	scsi_host_put(shost);
 
 	return 1;
 }
@@ -1749,7 +1750,6 @@ static void sym2_remove(struct pci_dev *
 	struct Scsi_Host *shost = pci_get_drvdata(pdev);
 
 	scsi_remove_host(shost);
-	scsi_host_put(shost);
 	sym_detach(shost, pdev);
 	pci_release_regions(pdev);
 	pci_disable_device(pdev);


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux