scsi: core: fix error handling for scsi_alloc_sdev()
PATCH v2 1/1 scsi: core: fix error handling for scsi_alloc_sdev()
After scsi_sysfs_device_initialize() was called, error paths must call __scsi_remove_device().
Fixes 1ac22c8eae81 ("scsi: core: Fix refcount leak for tagset_refcnt")
Signed-off-by Junxiao Bi <[email protected]>
---
v2 <- v1:
- fix patch log
drivers/scsi/scsi_scan.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/scsi/scsi_scan.c +2 -6
@@ -360,12 +360,8 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,* default device queue depth to figure out sbitmap shift * since we use this queue depth most of times. */ -if (scsi_realloc_sdev_budget_map (sdev, depth)) { -kref_put (&sdev->host->tagset_refcnt, scsi_mq_free_tags); -put_device (&starget->dev); -kfree (sdev); - goto out; - } +if (scsi_realloc_sdev_budget_map (sdev, depth)) + goto out_device_destroy;scsi_change_queue_depth (sdev, depth);
Signature · 1 line
2.50.1 (Apple Git-155)
Quoted 6 lines · Junxiao Bi
After
scsi_sysfs_device_initialize()was called, error paths must call__scsi_remove_device().Fixes 1ac22c8eae81 ("scsi: core: Fix refcount leak for tagset_refcnt")Signed-off-by Junxiao Bi <[email protected]>
Reviewed-by John Garry <[email protected]>
Quoted 2 lines · Junxiao Bi
After
scsi_sysfs_device_initialize()was called, error paths must call__scsi_remove_device().
My suggestion was to include the above sentence in the patch description instead of replacing the entire patch description with the above sentence. Anyway:
Reviewed-by Bart Van Assche <[email protected]>
Martin K. Petersen
AppliedQuoted 4 lines · Junxiao Bi
After
scsi_sysfs_device_initialize()was called, error paths must call__scsi_remove_device().
Applied to 7.0/scsi-fixes, thanks!
[1/1] scsi: core: fix error handling for scsi_alloc_sdev()
https://git.kernel.org/mkp/scsi/c/4ce7ada40c00
Signature · 1 line
Martin K. Petersen