kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Keith Busch <keith.busch@intel.com>
To: kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] nvme-pci: Fix an error handling path in 'nvme_probe()'
Date: Mon, 17 Jul 2017 16:09:18 +0000	[thread overview]
Message-ID: <20170717160918.GD24365@localhost.localdomain> (raw)
In-Reply-To: <20170716083903.7108-1-christophe.jaillet@wanadoo.fr>

On Sun, Jul 16, 2017 at 10:39:03AM +0200, Christophe JAILLET wrote:
> Release resources in the correct order in order not to miss a
> 'put_device()' if 'nvme_dev_map()' fails.
> 
> Fixes: b00a726a9fd8 ("NVMe: Don't unmap controller registers on reset")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Indeed, thanks for the fix. Alternatively this can be fixed by relocating
nvme_dev_map prior to the 'get_device' a few lines up. This patch is
okay, too.

Reviewed-by: Keith Busch <keith.busch@intel.com>

> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index d10d2f279d19..005beffd005d 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -2282,7 +2282,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>  
>  	result = nvme_dev_map(dev);
>  	if (result)
> -		goto free;
> +		goto put_pci;
>  
>  	INIT_WORK(&dev->ctrl.reset_work, nvme_reset_work);
>  	INIT_WORK(&dev->remove_work, nvme_remove_dead_ctrl_work);
> @@ -2291,7 +2291,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>  
>  	result = nvme_setup_prp_pools(dev);
>  	if (result)
> -		goto put_pci;
> +		goto unmap;
>  
>  	quirks |= check_dell_samsung_bug(pdev);
>  
> @@ -2308,9 +2308,10 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>  
>   release_pools:
>  	nvme_release_prp_pools(dev);
> + unmap:
> +	nvme_dev_unmap(dev);
>   put_pci:
>  	put_device(dev->dev);
> -	nvme_dev_unmap(dev);
>   free:
>  	kfree(dev->queues);
>  	kfree(dev);

      reply	other threads:[~2017-07-17 16:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-16  8:39 [PATCH] nvme-pci: Fix an error handling path in 'nvme_probe()' Christophe JAILLET
2017-07-17 16:09 ` Keith Busch [this message]

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=20170717160918.GD24365@localhost.localdomain \
    --to=keith.busch@intel.com \
    --cc=kernel-janitors@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).