linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bodo Stroesser <bstroesser@ts.fujitsu.com>
To: linux-scsi@vger.kernel.org, bstroesser@ts.fujitsu.com
Subject: PATCH: st.c: Fix blk_get_queue usage
Date: 14 Nov 2013 15:48:02 +0100	[thread overview]
Message-ID: <d6437a$53lu6d@dgate10u.abg.fsc.net> (raw)

Hi,

in st_probe(), st.c I stumbled across what I'd call a minor problem.

So I'd like to suggest the following patch.

Best Regards,
Bodo

P.S.: Please CC me, I'm not on the list.

---------------------------------------------------------------------


From: Bodo Stroesser <bstroesser@ts.fujitsu.com>
Date: Thu, 14 Nov 2013 14:35:00 +0100
Subject: [PATCH] sg: 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().

Signed-off-by: Bodo Stroesser <bstroesser@ts.fujitsu.com>

---

--- a/drivers/scsi/st.c	2013-11-14 14:10:40.000000000 +0100
+++ b/drivers/scsi/st.c	2013-11-14 14:10:57.000000000 +0100
@@ -4107,11 +4107,11 @@
 	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))
 		goto out_put_disk;
+	disk->queue = SDp->request_queue;
 	tpnt->driver = &st_template;
 
 	tpnt->device = SDp;

             reply	other threads:[~2013-11-14 14:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-14 14:48 Bodo Stroesser [this message]
2013-11-14 19:05 ` PATCH: st.c: Fix blk_get_queue usage "Kai Mäkisara (Kolumbus)"
  -- strict thread matches above, loose matches on Subject: below --
2013-11-14 19:22 Bodo Stroesser
2013-11-14 21:08 ` Kai Makisara
2013-11-14 21:50 ` Joe Lawrence
2013-11-15 11:23 Bodo Stroesser
2013-11-15 16:59 ` Joe Lawrence

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='d6437a$53lu6d@dgate10u.abg.fsc.net' \
    --to=bstroesser@ts.fujitsu.com \
    --cc=linux-scsi@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).