nvme: fix controller instance leak
Keith Busch
maintainerPATCH 1/1 nvme: fix controller instance leak
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.
--- drivers/nvme/host/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/core.c +1 -1
@@ -4390,7 +4390,7 @@ static void nvme_free_ctrl(struct device *dev)struct nvme_subsystem *subsys = ctrl->subsys;struct nvme_cel *cel, *next; -if (subsys && ctrl->instance != subsys->instance) +if (!subsys || ctrl->instance != subsys->instance)ida_simple_remove (&nvme_instance_ida, ctrl->instance);list_for_each_entry_safe (cel, next, &ctrl->cels, entry) {
Signature · 7 lines
2.24.1 _______________________________________________ Linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
Quoted 7 lines · Keith Busch
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<[email protected]>
Looks good.
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Quoted 7 lines · Keith Busch
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 <[email protected]>
Looks good,
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme