Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: "Ewan D. Milne" <emilne@redhat.com>
To: Hannes Reinecke <hare@suse.de>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
	"Kai Mäkisara" <Kai.Makisara@kolumbus.fi>,
	"Christoph Hellwig" <hch@lst.de>,
	"James Bottomley" <james.bottomley@hansenpartnership.com>,
	linux-scsi@vger.kernel.org,
	"Bodo Stroesser" <bstroesser@ts.fujitsu.com>,
	"Hannes Reinecke" <hare@suse.com>
Subject: Re: [PATCH] st: fix blk_get_queue usage
Date: Tue, 01 Aug 2017 12:03:25 -0400	[thread overview]
Message-ID: <1501603405.4120.35.camel@localhost.localdomain> (raw)
In-Reply-To: <1501591374-11229-1-git-send-email-hare@suse.de>

On Tue, 2017-08-01 at 14:42 +0200, Hannes Reinecke wrote:
> 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;

Fixes: 2b5bebccd282 ("st: Take additional queue ref in st_probe")
Reviewed-by: Ewan D. Milne <emilne@redhat.com>

  reply	other threads:[~2017-08-01 16:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-01 12:42 [PATCH] st: fix blk_get_queue usage Hannes Reinecke
2017-08-01 16:03 ` Ewan D. Milne [this message]
2017-08-01 19:19 ` "Kai Mäkisara (Kolumbus)"
2017-08-07 17:40 ` Martin K. Petersen

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=1501603405.4120.35.camel@localhost.localdomain \
    --to=emilne@redhat.com \
    --cc=Kai.Makisara@kolumbus.fi \
    --cc=bstroesser@ts.fujitsu.com \
    --cc=hare@suse.com \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=james.bottomley@hansenpartnership.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@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