Skip to content

Commit

Permalink
nvme-core: use list_add_tail_rcu instead of list_add_tail for nvme_in…
Browse files Browse the repository at this point in the history
…it_ns_head

The "list" of nvme_ns_head is used as rcu list, now in nvme_init_ns_head
list_add_tail is used to add ns->siblings to the rcu list. It is not safe.
Should use list_add_tail_rcu instead of list_add_tail.

Signed-off-by: Chao Leng <lengchao@huawei.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
  • Loading branch information
Chao Leng authored and Christoph Hellwig committed Jan 28, 2021
1 parent d1bcf00 commit 772ea32
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/nvme/host/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -3829,7 +3829,7 @@ static int nvme_init_ns_head(struct nvme_ns *ns, unsigned nsid,
}
}

list_add_tail(&ns->siblings, &head->list);
list_add_tail_rcu(&ns->siblings, &head->list);
ns->head = head;
mutex_unlock(&ctrl->subsys->lock);
return 0;
Expand Down

0 comments on commit 772ea32

Please sign in to comment.