mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-22 07:27:12 +08:00
scsi: core: Fix error handling for scsi_alloc_sdev()
After scsi_sysfs_device_initialize() was called, error paths must call
__scsi_remove_device().
Fixes: 1ac22c8eae ("scsi: core: Fix refcount leak for tagset_refcnt")
Cc: stable@vger.kernel.org
Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Link: https://patch.msgid.link/20260304164603.51528-1-junxiao.bi@oracle.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
committed by
Martin K. Petersen
parent
14d4ac19d1
commit
4ce7ada40c
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user