* [PATCH] nvme: fix controller instance leak
@ 2020-08-26 17:53 Keith Busch
2020-08-26 18:10 ` Chaitanya Kulkarni
2020-08-27 6:40 ` Christoph Hellwig
0 siblings, 2 replies; 3+ messages in thread
From: Keith Busch @ 2020-08-26 17:53 UTC (permalink / raw)
To: linux-nvme, hch, sagi; +Cc: 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 <kbusch@kernel.org>
---
drivers/nvme/host/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 154942fc64eb..be7c609b3d07 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -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) {
--
2.24.1
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] nvme: fix controller instance leak
2020-08-26 17:53 [PATCH] nvme: fix controller instance leak Keith Busch
@ 2020-08-26 18:10 ` Chaitanya Kulkarni
2020-08-27 6:40 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Chaitanya Kulkarni @ 2020-08-26 18:10 UTC (permalink / raw)
To: Keith Busch, linux-nvme, hch, sagi
On 8/26/20 11:01, Keith Busch wrote:
> 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@kernel.org>
Looks good.
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nvme: fix controller instance leak
2020-08-26 17:53 [PATCH] nvme: fix controller instance leak Keith Busch
2020-08-26 18:10 ` Chaitanya Kulkarni
@ 2020-08-27 6:40 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2020-08-27 6:40 UTC (permalink / raw)
To: Keith Busch; +Cc: hch, linux-nvme, sagi
On Wed, Aug 26, 2020 at 10:53:04AM -0700, Keith Busch wrote:
> 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@kernel.org>
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-08-27 6:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-26 17:53 [PATCH] nvme: fix controller instance leak Keith Busch
2020-08-26 18:10 ` Chaitanya Kulkarni
2020-08-27 6:40 ` Christoph Hellwig
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.