Skip to content

Commit ec5c17c

Browse files
biger410gregkh
authored andcommitted
scsi: core: Fix refcount leak for tagset_refcnt
commit 1ac22c8eae81366101597d48360718dff9b9d980 upstream. This leak will cause a hang when tearing down the SCSI host. For example, iscsid hangs with the following call trace: [130120.652718] scsi_alloc_sdev: Allocation failure during SCSI scanning, some SCSI devices might not be configured PID: 2528 TASK: ffff9d0408974e00 CPU: 3 COMMAND: "iscsid" #0 [ffffb5b9c134b9e0] __schedule at ffffffff860657d4 microsoft#1 [ffffb5b9c134ba28] schedule at ffffffff86065c6f microsoft#2 [ffffb5b9c134ba40] schedule_timeout at ffffffff86069fb0 microsoft#3 [ffffb5b9c134bab0] __wait_for_common at ffffffff8606674f microsoft#4 [ffffb5b9c134bb10] scsi_remove_host at ffffffff85bfe84b #5 [ffffb5b9c134bb30] iscsi_sw_tcp_session_destroy at ffffffffc03031c4 [iscsi_tcp] #6 [ffffb5b9c134bb48] iscsi_if_recv_msg at ffffffffc0292692 [scsi_transport_iscsi] #7 [ffffb5b9c134bb98] iscsi_if_rx at ffffffffc02929c2 [scsi_transport_iscsi] #8 [ffffb5b9c134bbf0] netlink_unicast at ffffffff85e551d6 #9 [ffffb5b9c134bc38] netlink_sendmsg at ffffffff85e554ef Fixes: 8fe4ce5 ("scsi: core: Fix a use-after-free") Cc: stable@vger.kernel.org Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com> Reviewed-by: Mike Christie <michael.christie@oracle.com> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Link: https://patch.msgid.link/20260223232728.93350-1-junxiao.bi@oracle.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent b746a35 commit ec5c17c

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

drivers/scsi/scsi_scan.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
354354
* since we use this queue depth most of times.
355355
*/
356356
if (scsi_realloc_sdev_budget_map(sdev, depth)) {
357+
kref_put(&sdev->host->tagset_refcnt, scsi_mq_free_tags);
357358
put_device(&starget->dev);
358359
kfree(sdev);
359360
goto out;

0 commit comments

Comments
 (0)