mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 20:32:04 +09:00
fix memory leak in scsi_report_lun_scan
commit 75f8ee8e01 upstream.
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>
Cc: Hannes Reinecke <hare@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
0a4f14ecb6
commit
3c08ee489d
@@ -1336,8 +1336,10 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags,
|
||||
sdev = scsi_alloc_sdev(starget, 0, NULL);
|
||||
if (!sdev)
|
||||
return 0;
|
||||
if (scsi_device_get(sdev))
|
||||
if (scsi_device_get(sdev)) {
|
||||
__scsi_remove_device(sdev);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
sprintf(devname, "host %d channel %d id %d",
|
||||
|
||||
Reference in New Issue
Block a user