mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
nvmet: nul-terminate the NQNs passed in the connect command
[ Upstream commit 1c22e0295a5eb571c27b53c7371f95699ef705ff ]
The host and subsystem NQNs are passed in the connect command payload and
interpreted as nul-terminated strings. Ensure they actually are
nul-terminated before using them.
Fixes: a07b4970f4 "nvmet: add a generic NVMe target")
Reported-by: Alon Zahavi <zahavi.alon@gmail.com>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
573fa2b708
commit
0e485f12eb
@@ -244,6 +244,8 @@ static void nvmet_execute_admin_connect(struct nvmet_req *req)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
d->subsysnqn[NVMF_NQN_FIELD_LEN - 1] = '\0';
|
||||||
|
d->hostnqn[NVMF_NQN_FIELD_LEN - 1] = '\0';
|
||||||
status = nvmet_alloc_ctrl(d->subsysnqn, d->hostnqn, req,
|
status = nvmet_alloc_ctrl(d->subsysnqn, d->hostnqn, req,
|
||||||
le32_to_cpu(c->kato), &ctrl);
|
le32_to_cpu(c->kato), &ctrl);
|
||||||
if (status)
|
if (status)
|
||||||
@@ -313,6 +315,8 @@ static void nvmet_execute_io_connect(struct nvmet_req *req)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
d->subsysnqn[NVMF_NQN_FIELD_LEN - 1] = '\0';
|
||||||
|
d->hostnqn[NVMF_NQN_FIELD_LEN - 1] = '\0';
|
||||||
ctrl = nvmet_ctrl_find_get(d->subsysnqn, d->hostnqn,
|
ctrl = nvmet_ctrl_find_get(d->subsysnqn, d->hostnqn,
|
||||||
le16_to_cpu(d->cntlid), req);
|
le16_to_cpu(d->cntlid), req);
|
||||||
if (!ctrl) {
|
if (!ctrl) {
|
||||||
|
|||||||
Reference in New Issue
Block a user