mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-05 00:20:32 +00:00
[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>
This commit is contained in:
parent
277e76f182
commit
75f8ee8e01
1 changed files with 3 additions and 1 deletions
|
@ -1339,8 +1339,10 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags,
|
||||||
sdev = scsi_alloc_sdev(starget, 0, NULL);
|
sdev = scsi_alloc_sdev(starget, 0, NULL);
|
||||||
if (!sdev)
|
if (!sdev)
|
||||||
return 0;
|
return 0;
|
||||||
if (scsi_device_get(sdev))
|
if (scsi_device_get(sdev)) {
|
||||||
|
__scsi_remove_device(sdev);
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(devname, "host %d channel %d id %d",
|
sprintf(devname, "host %d channel %d id %d",
|
||||||
|
|
Loading…
Reference in a new issue