All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] st: fix blk_get_queue usage
@ 2017-08-01 12:42 Hannes Reinecke
  2017-08-01 16:03 ` Ewan D. Milne
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Hannes Reinecke @ 2017-08-01 12:42 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Kai Mäkisara, Christoph Hellwig, James Bottomley, linux-scsi,
	Bodo Stroesser, Hannes Reinecke

From: Bodo Stroesser <bstroesser@ts.fujitsu.com>

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().

Signed-off-by: Bodo Stroesser <bstroesser@ts.fujitsu.com>
Acked-by: Shirish Pargaonkar <spargaonkar@suse.com>
Signed-off-by: Hannes Reinecke <hare@suse.com>
---
 drivers/scsi/st.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 1ea34d6..f1bcaf6 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -4300,11 +4300,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;
-- 
1.8.5.6

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-08-07 17:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-01 12:42 [PATCH] st: fix blk_get_queue usage Hannes Reinecke
2017-08-01 16:03 ` Ewan D. Milne
2017-08-01 19:19 ` "Kai Mäkisara (Kolumbus)"
2017-08-07 17:40 ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.