public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: "hch@lst.de" <hch@lst.de>
To: Bart Van Assche <Bart.VanAssche@sandisk.com>
Cc: "hare@suse.de" <hare@suse.de>,
	"martin.petersen@oracle.com" <martin.petersen@oracle.com>,
	"hch@lst.de" <hch@lst.de>,
	"keith.busch@inter.com" <keith.busch@inter.com>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"hare@suse.com" <hare@suse.com>
Subject: Re: [PATCH] scsi_dh: only attach to SCSI devices
Date: Thu, 16 Feb 2017 15:38:17 +0100	[thread overview]
Message-ID: <20170216143817.GA32302@lst.de> (raw)
In-Reply-To: <1487255419.2973.1.camel@sandisk.com>

On Thu, Feb 16, 2017 at 02:30:34PM +0000, Bart Van Assche wrote:
> >  	sdev = q->queuedata;
> > -	if (!sdev || !get_device(&sdev->sdev_gendev))
> > +	if (!sdev ||
> > +	    !scsi_is_sdev_device(&sdev->sdev_gendev) ||
> > +	    !get_device(&sdev->sdev_gendev))
> >  		sdev = NULL;
> >  	spin_unlock_irqrestore(q->queue_lock, flags);
> 
> Hello Hannes,
> 
> Sorry but this approach looks wrong to me. A block driver can store any data
> in .queuedata, even data that would cause the scsi_is_sdev_device() function
> to crash.

Yes, I fear you're right.  I guess we need to call into the scsi_dh_*
functions through an indirection mediated by the block layer.

  reply	other threads:[~2017-02-16 14:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-16  7:33 [PATCH] scsi_dh: only attach to SCSI devices Hannes Reinecke
2017-02-16 14:30 ` Bart Van Assche
2017-02-16 14:38   ` hch [this message]
2017-02-16 14:38     ` Hannes Reinecke
2017-02-16 14:32 ` Christoph Hellwig
2017-02-16 14:35   ` Bart Van Assche

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=20170216143817.GA32302@lst.de \
    --to=hch@lst.de \
    --cc=Bart.VanAssche@sandisk.com \
    --cc=hare@suse.com \
    --cc=hare@suse.de \
    --cc=keith.busch@inter.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