All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme: Remove ns sibling before clearing path
@ 2018-10-05 14:57 Keith Busch
  2018-10-05 18:11 ` Sagi Grimberg
  2018-10-08  9:55 ` Christoph Hellwig
  0 siblings, 2 replies; 3+ messages in thread
From: Keith Busch @ 2018-10-05 14:57 UTC (permalink / raw)


The code had been clearing a namespace being deleted as the current
path while that namespace was still in the path siblings list. It is
possible a new IO could set that namespace back to the current path
since it appeared to be an eligable path to select, which may result in
a use-after-free error.

This patch ensures a namespace being removed is not eligable to be reset
as a current path prior to clearing it as the current path.

Signed-off-by: Keith Busch <keith.busch at intel.com>
---
 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 2db33a752e2b..db808d60749d 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3145,8 +3145,8 @@ static void nvme_ns_remove(struct nvme_ns *ns)
 	}
 
 	mutex_lock(&ns->ctrl->subsys->lock);
-	nvme_mpath_clear_current_path(ns);
 	list_del_rcu(&ns->siblings);
+	nvme_mpath_clear_current_path(ns);
 	mutex_unlock(&ns->ctrl->subsys->lock);
 
 	down_write(&ns->ctrl->namespaces_rwsem);
-- 
2.14.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] nvme: Remove ns sibling before clearing path
  2018-10-05 14:57 [PATCH] nvme: Remove ns sibling before clearing path Keith Busch
@ 2018-10-05 18:11 ` Sagi Grimberg
  2018-10-08  9:55 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Sagi Grimberg @ 2018-10-05 18:11 UTC (permalink / raw)


Reviewed-by: Sagi Grimberg <sagi at grimberg.me>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] nvme: Remove ns sibling before clearing path
  2018-10-05 14:57 [PATCH] nvme: Remove ns sibling before clearing path Keith Busch
  2018-10-05 18:11 ` Sagi Grimberg
@ 2018-10-08  9:55 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2018-10-08  9:55 UTC (permalink / raw)


Thanks,

applied to nvme-4.19.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-10-08  9:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-05 14:57 [PATCH] nvme: Remove ns sibling before clearing path Keith Busch
2018-10-05 18:11 ` Sagi Grimberg
2018-10-08  9:55 ` 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.