Skip to content

Commit 48f78be

Browse files
Keith BuschChristoph Hellwig
authored andcommitted
nvme: remove ns sibling before clearing path
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@intel.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Christoph Hellwig <hch@lst.de>
1 parent 133424a commit 48f78be

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
@@ -3143,8 +3143,8 @@ static void nvme_ns_remove(struct nvme_ns *ns)
31433143
}
31443144

31453145
mutex_lock(&ns->ctrl->subsys->lock);
3146-
nvme_mpath_clear_current_path(ns);
31473146
list_del_rcu(&ns->siblings);
3147+
nvme_mpath_clear_current_path(ns);
31483148
mutex_unlock(&ns->ctrl->subsys->lock);
31493149

31503150
down_write(&ns->ctrl->namespaces_rwsem);

0 commit comments

Comments
 (0)