From: Junxiao Bi <junxiao.bi@oracle.com>
To: linux-scsi@vger.kernel.org
Cc: martin.petersen@oracle.com,
James.Bottomley@HansenPartnership.com,
michael.christie@oracle.com, bvanassche@acm.org,
john.g.garry@oracle.com, junxiao.bi@oracle.com
Subject: [PATCH 7.0/scsi-fixes] scsi: core: fix error handling for scsi_alloc_sdev()
Date: Tue, 3 Mar 2026 13:32:33 -0800 [thread overview]
Message-ID: <20260303213233.43166-1-junxiao.bi@oracle.com> (raw)
scsi_sysfs_device_initialize() was already invoked when
scsi_realloc_sdev_budget_map() fail, it will need invoke
__scsi_remove_device() to do the error handling.
Fixes: 1ac22c8eae81 ("scsi: core: Fix refcount leak for tagset_refcnt")
Cc: stable@vger.kernel.org
Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com>
---
drivers/scsi/scsi_scan.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 2cfcf1f5d6a4..7b11bc7de0e3 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -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);
--
2.50.1 (Apple Git-155)
next reply other threads:[~2026-03-03 21:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-03 21:32 Junxiao Bi [this message]
2026-03-04 14:49 ` [PATCH 7.0/scsi-fixes] scsi: core: fix error handling for scsi_alloc_sdev() Bart Van Assche
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260303213233.43166-1-junxiao.bi@oracle.com \
--to=junxiao.bi@oracle.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=bvanassche@acm.org \
--cc=john.g.garry@oracle.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=michael.christie@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox