]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
nvme-core: use list_add_tail_rcu instead of list_add_tail for nvme_init_ns_head
authorChao Leng <lengchao@huawei.com>
Thu, 28 Jan 2021 03:33:51 +0000 (11:33 +0800)
committerChristoph Hellwig <hch@lst.de>
Thu, 28 Jan 2021 18:25:07 +0000 (19:25 +0100)
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>
drivers/nvme/host/core.c

index 8caf9b34734dc75d6abf16cfdd68d0ef0f515551..f13eb4ded95fad0ddf6076ed29f7c63f5ca67984 100644 (file)
@@ -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;