Commit 98096d8a authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Sagi Grimberg

nvme-fabrics: get a reference when reusing a nvme_host structure

Without this we'll get a use after free after connecting two controller
using the same hostnqn and then disconnecting one of them.
Signed-off-by: 's avatarChristoph Hellwig <>
Reviewed-by: 's avatarJay Freyensee <>
Signed-off-by: 's avatarSagi Grimberg <>
parent 7a665d2f
......@@ -47,8 +47,10 @@ static struct nvmf_host *nvmf_host_add(const char *hostnqn)
host = __nvmf_host_find(hostnqn);
if (host)
if (host) {
goto out_unlock;
host = kmalloc(sizeof(*host), GFP_KERNEL);
if (!host)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment