lkml.org 
[lkml]   [2018]   [Feb]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/9] nvme: fix the dangerous reference of namespaces list
From
Date
> 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?

\
 
 \ /
  Last update: 2018-02-11 12:16    [W:0.183 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site