aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2010-02-12 12:13:31 -0500
committerJames Bottomley <James.Bottomley@suse.de>2010-02-18 11:52:10 -0500
commit75f8ee8e01a6c96652f27da40d4bdac9e2e485f0 (patch)
tree0052eea0bf0ad22577c0ef1e89f9a4297b05e96a /drivers
parent277e76f1821ab131a409c6a2e04492ef5774fb3c (diff)
[SCSI] fix memory leak in scsi_report_lun_scan
This patch (as1333) fixes a bug in scsi_report_lun_scan(). If a newly-allocated device can't be used, it should be deleted. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/scsi_scan.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 012f73a96880..60b262d66b5b 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -1339,8 +1339,10 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags,
1339 sdev = scsi_alloc_sdev(starget, 0, NULL); 1339 sdev = scsi_alloc_sdev(starget, 0, NULL);
1340 if (!sdev) 1340 if (!sdev)
1341 return 0; 1341 return 0;
1342 if (scsi_device_get(sdev)) 1342 if (scsi_device_get(sdev)) {
1343 __scsi_remove_device(sdev);
1343 return 0; 1344 return 0;
1345 }
1344 } 1346 }
1345 1347
1346 sprintf(devname, "host %d channel %d id %d", 1348 sprintf(devname, "host %d channel %d id %d",