From: Hannes Reinecke <hare@suse.de>
To: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>,
Keith Busch <keith.busch@inter.com>,
linux-scsi@vger.kernel.org,
Bart van Assche <bart.vanassche@sandisk.com>,
Hannes Reinecke <hare@suse.de>, Hannes Reinecke <hare@suse.com>
Subject: [PATCH] scsi_dh: only attach to SCSI devices
Date: Thu, 16 Feb 2017 08:33:14 +0100 [thread overview]
Message-ID: <1487230394-84552-1-git-send-email-hare@suse.de> (raw)
Any device might be setting a queuedata structure, so we need to
check if the queuedata really belongs to a SCSI device before
proceeding.
Signed-off-by: Hannes Reinecke <hare@suse.com>
---
drivers/scsi/scsi_dh.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/scsi_dh.c b/drivers/scsi/scsi_dh.c
index b8d3b97..da104ed 100644
--- a/drivers/scsi/scsi_dh.c
+++ b/drivers/scsi/scsi_dh.c
@@ -226,7 +226,9 @@ static struct scsi_device *get_sdev_from_queue(struct request_queue *q)
spin_lock_irqsave(q->queue_lock, flags);
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);
--
1.8.5.6
next reply other threads:[~2017-02-16 7:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-16 7:33 Hannes Reinecke [this message]
2017-02-16 14:30 ` [PATCH] scsi_dh: only attach to SCSI devices Bart Van Assche
2017-02-16 14:38 ` hch
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=1487230394-84552-1-git-send-email-hare@suse.de \
--to=hare@suse.de \
--cc=bart.vanassche@sandisk.com \
--cc=hare@suse.com \
--cc=hch@lst.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