Commit 180efde0 authored by Bodo Stroesser's avatar Bodo Stroesser Committed by Martin K. Petersen

scsi: st: fix blk_get_queue usage

If blk_queue_get() in st_probe fails, disk->queue must not be set to
SDp->request_queue, as that would result in put_disk() dropping a not
taken reference.

Thus, disk->queue should be set only after a successful blk_queue_get().

Fixes: 2b5bebcc ("st: Take additional queue ref in st_probe")
Signed-off-by: default avatarBodo Stroesser <bstroesser@ts.fujitsu.com>
Acked-by: default avatarShirish Pargaonkar <spargaonkar@suse.com>
Signed-off-by: default avatarHannes Reinecke <hare@suse.com>
Reviewed-by: default avatarEwan D. Milne <emilne@redhat.com>
Acked-by: default avatarKai Mäkisara <kai.makisara@kolumbus.fi>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent be37aa4b
......@@ -4299,11 +4299,11 @@ static int st_probe(struct device *dev)
kref_init(&tpnt->kref);
tpnt->disk = disk;
disk->private_data = &tpnt->driver;
disk->queue = SDp->request_queue;
/* SCSI tape doesn't register this gendisk via add_disk(). Manually
* take queue reference that release_disk() expects. */
if (!blk_get_queue(disk->queue))
if (!blk_get_queue(SDp->request_queue))
goto out_put_disk;
disk->queue = SDp->request_queue;
tpnt->driver = &st_template;
tpnt->device = SDp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment