提交 75f8ee8e 编写于 作者: A Alan Stern 提交者: James Bottomley

[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: NAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
上级 277e76f1
......@@ -1339,8 +1339,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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册