Patch "nvme: fix controller instance leak" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    nvme: fix controller instance leak

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     nvme-fix-controller-instance-leak.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit bc1cb94594f3dcb748ac92db3e686526759a58e5
Author: Keith Busch <kbusch@xxxxxxxxxx>
Date:   Wed Aug 26 10:53:04 2020 -0700

    nvme: fix controller instance leak
    
    [ Upstream commit 192f6c29bb28bfd0a17e6ad331d09f1ec84143d0 ]
    
    If the driver has to unbind from the controller for an early failure
    before the subsystem has been set up, there won't be a subsystem holding
    the controller's instance, so the controller needs to free its own
    instance in this case.
    
    Fixes: 733e4b69d508d ("nvme: Assign subsys instance from first ctrl")
    Signed-off-by: Keith Busch <kbusch@xxxxxxxxxx>
    Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@xxxxxxx>
    Reviewed-by: Christoph Hellwig <hch@xxxxxx>
    Signed-off-by: Sagi Grimberg <sagi@xxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index ff5681da8780d..3cb017fa3a790 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -4012,7 +4012,7 @@ static void nvme_free_ctrl(struct device *dev)
 		container_of(dev, struct nvme_ctrl, ctrl_device);
 	struct nvme_subsystem *subsys = ctrl->subsys;
 
-	if (subsys && ctrl->instance != subsys->instance)
+	if (!subsys || ctrl->instance != subsys->instance)
 		ida_simple_remove(&nvme_instance_ida, ctrl->instance);
 
 	kfree(ctrl->effects);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux