summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChao Leng <lengchao@huawei.com>2021-01-28 11:33:51 +0800
committerChristoph Hellwig <hch@lst.de>2021-01-28 19:25:07 +0100
commit772ea326a4a00b6b4b2c8f3606ad10c31f46c511 (patch)
treeb97bbf08ee21a22401cb7db3e81a14a4ea7ce89b
parentd1bcf006a9d3d63c1bcb65a993cb13756954cd9c (diff)
downloadlinux-772ea326a4a00b6b4b2c8f3606ad10c31f46c511.tar.bz2
nvme-core: use list_add_tail_rcu instead of list_add_tail for nvme_init_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>
-rw-r--r--drivers/nvme/host/core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 8caf9b34734d..f13eb4ded95f 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -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;