Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: mr.nuke.me@gmail.com (Alex G.)
Subject: [PATCH] nvme-pci: Skip queue deletion if there are no queues
Date: Wed, 28 Mar 2018 15:13:37 -0500	[thread overview]
Message-ID: <d5c52e3e-977d-7f44-bd7d-4ec5b82d39c1@gmail.com> (raw)
In-Reply-To: <e872954fedc943c08ef11451679d5a2c@AUSX13MPS305.AMER.DELL.COM>

Hi Keith,

> User reported controller always retains CSTS.RDY to 1, which fails
> controller disabling when resetting the controller. This is also before
> the admin queue is allocated, and trying to disable an unallocated queue
> results in a NULL dereference.
> 
> Reported-by: Alex Gagniuc <Alex_Gagniuc at Dellteam.com>
> Signed-off-by: Keith Busch <keith.busch at intel.com>
> ---
>  drivers/nvme/host/pci.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index cef5ce851a92..b110eac1d0e6 100644

Which branch am I supposed to be using to test this? It doesn't apply to
mainline.

> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -2200,7 +2200,7 @@ static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown)
>  
>  	nvme_stop_queues(&dev->ctrl);
>  
> -	if (!dead) {
> +	if (!dead && dev->ctrl.queue_count > 0) {

Is this around the calls to nvme_disable_io_queues() and
nvme_disable_admin_queue()?
Coming as an outsider with limited experience regarding the nvme driver
it seems it might be more robust to move this check to
nvme_disable_admin_queue().

Alex

>  		/*
>  		 * If the controller is still alive tell it to stop using the
>  		 * host memory buffer.  In theory the shutdown / reset should
> 

  parent reply	other threads:[~2018-03-28 20:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-28 18:04 [PATCH] nvme-pci: Skip queue deletion if there are no queues Keith Busch
     [not found] ` <e872954fedc943c08ef11451679d5a2c@AUSX13MPS305.AMER.DELL.COM>
2018-03-28 20:13   ` Alex G. [this message]
2018-03-28 20:22     ` Keith Busch
2018-03-28 21:02       ` Alex G.
2018-04-04 13:00 ` Sagi Grimberg

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=d5c52e3e-977d-7f44-bd7d-4ec5b82d39c1@gmail.com \
    --to=mr.nuke.me@gmail.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