[stable 3.13.11.y][trusty SRU][PATCH] NVMe: Initialize device reference count earlier

Kamal Mostafa kamal at canonical.com
Tue Oct 21 17:58:16 UTC 2014


Hi Chris-

FYI, This patch ("NVMe: Initialize device reference count earlier") is
fine for Trusty, but is not relevant for 3.13-stable, because
3.13-stable does not carry this earlier commit:

        9ac2709 NVMe: Namespace use after free on surprise removal

(Trusty does have that commit as 67c4779)

 -Kamal


On Fri, 2014-10-17 at 10:05 +0200, Chris J Arges wrote:
> From: Keith Busch <keith.busch at intel.com>
> 
> BugLink: http://bugs.launchpad.net/bugs/1382221
> 
> If an NVMe device becomes ready but fails to create IO queues, the driver
> creates a character device handle so the device can be managed. The
> device reference count needs to be initialized before creating the
> character device.
> 
> Signed-off-by: Keith Busch <keith.busch at intel.com>
> Signed-off-by: Matthew Wilcox <matthew.r.wilcox at intel.com>
> (cherry picked from commit fb35e914b3f88cda9ee6f9d776910c35269c4ecf)
> Signed-off-by: Chris J Arges <chris.j.arges at canonical.com>
> ---
>  drivers/block/nvme-core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
> index cd39390..53f0c5e 100644
> --- a/drivers/block/nvme-core.c
> +++ b/drivers/block/nvme-core.c
> @@ -2546,6 +2546,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>  	if (result)
>  		goto release;
>  
> +	kref_init(&dev->kref);
>  	result = nvme_dev_start(dev);
>  	if (result) {
>  		if (result == -EBUSY)
> @@ -2553,7 +2554,6 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>  		goto release_pools;
>  	}
>  
> -	kref_init(&dev->kref);
>  	result = nvme_dev_add(dev);
>  	if (result)
>  		goto shutdown;






More information about the kernel-team mailing list