Skip to content

Commit 50d2847

Browse files
keithbuschgregkh
authored andcommitted
nvme: fix controller instance leak
[ Upstream commit 192f6c2 ] 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: 733e4b6 ("nvme: Assign subsys instance from first ctrl") Signed-off-by: Keith Busch <[email protected]> Reviewed-by: Chaitanya Kulkarni <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Sagi Grimberg <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent f4b830c commit 50d2847

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/nvme/host/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4012,7 +4012,7 @@ static void nvme_free_ctrl(struct device *dev)
40124012
container_of(dev, struct nvme_ctrl, ctrl_device);
40134013
struct nvme_subsystem *subsys = ctrl->subsys;
40144014

4015-
if (subsys && ctrl->instance != subsys->instance)
4015+
if (!subsys || ctrl->instance != subsys->instance)
40164016
ida_simple_remove(&nvme_instance_ida, ctrl->instance);
40174017

40184018
kfree(ctrl->effects);

0 commit comments

Comments
 (0)