nvmet: nul-terminate the NQNs passed in the connect command
Subsystems (2)
Christoph Hellwig
maintainerPATCH v2 1/1 nvmet: nul-terminate the NQNs passed in the connect command
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.
--- drivers/nvme/target/fabrics-cmd.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/nvme/target/fabrics-cmd.c +4 -0
@@ -244,6 +244,8 @@ static void nvmet_execute_admin_connect(struct nvmet_req *req) 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,le32_to_cpu (c->kato), &ctrl);if (status)
@@ -313,6 +315,8 @@ static void nvmet_execute_io_connect(struct nvmet_req *req) 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,le16_to_cpu (d->cntlid), req);if (!ctrl) {
Signature · 1 line
2.39.2
Keith Busch
maintainerQuoted 7 lines · Christoph Hellwig
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 a07b4970f464 "nvmet: add a generic NVMe target")Reported-by Alon Zahavi <[email protected]>Signed-off-by Christoph Hellwig <[email protected]>
Applied for nvme-6.7, thanks!
Quoted 11 lines · Keith Busch
Quoted 7 lines · Christoph Hellwig
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 a07b4970f464 "nvmet: add a generic NVMe target")Reported-by Alon Zahavi <[email protected]>Signed-off-by Christoph Hellwig <[email protected]>Applied for nvme-6.7, thanks!
if this is on the top of the tree can you please add my reviewed-by tag posted earlier ?
-ck
Quoted 8 lines · Christoph Hellwig
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 a07b4970f464 "nvmet: add a generic NVMe target")Reported-by Alon Zahavi <[email protected]>Signed-off-by Christoph Hellwig <[email protected]>---
-ck