Commit 3c08ee48 authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman

fix memory leak in scsi_report_lun_scan

commit 75f8ee8e 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: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
Cc: Hannes Reinecke <hare@suse.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 0a4f14ec
......@@ -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",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment