Messages in this thread |  | | Subject | Re: [PATCH 1/9] nvme: fix the dangerous reference of namespaces list | From | Sagi Grimberg <> | Date | Sun, 11 Feb 2018 13:15:47 +0200 |
| |
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c > index e810487..bc05bc4 100644 > --- a/drivers/nvme/host/core.c > +++ b/drivers/nvme/host/core.c > @@ -3092,11 +3092,20 @@ static void nvme_remove_invalid_namespaces(struct nvme_ctrl *ctrl, > unsigned nsid) > { > struct nvme_ns *ns, *next; > + LIST_HEAD(rm_list); > > + mutex_lock(&ctrl->namespaces_mutex); > list_for_each_entry_safe(ns, next, &ctrl->namespaces, list) { > - if (ns->head->ns_id > nsid) > - nvme_ns_remove(ns); > + if (ns->head->ns_id > nsid) { > + list_del_init(&ns->list); > + list_add_tail(&ns->list, &rm_list);
list_move_tail?
|  |