mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
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: Christoph Hellwig <[email protected]> Reviewed-by: Jay Freyensee <[email protected]> Signed-off-by: Sagi Grimberg <[email protected]>
This commit is contained in:
parent
7a665d2f60
commit
98096d8a78
1 changed files with 3 additions and 1 deletions
|
|
@ -47,8 +47,10 @@ static struct nvmf_host *nvmf_host_add(const char *hostnqn)
|
|||
|
||||
mutex_lock(&nvmf_hosts_mutex);
|
||||
host = __nvmf_host_find(hostnqn);
|
||||
if (host)
|
||||
if (host) {
|
||||
kref_get(&host->ref);
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
host = kmalloc(sizeof(*host), GFP_KERNEL);
|
||||
if (!host)
|
||||
|
|
|
|||
Loading…
Reference in a new issue