nvmet: nul-terminate the NQNs passed in the connect command
authorChristoph Hellwig <hch@lst.de>
Fri, 17 Nov 2023 13:13:36 +0000 (08:13 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 3 Dec 2023 06:33:06 +0000 (07:33 +0100)
commit2291653c27236d34ca7df3bfd3427ce6e30c2d95
tree053729bd58a1747da267a3e80932b718acc8da6e
parent399d76d3306453200621f8b5c6fc7df28c659dcd
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: a07b4970f464 "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>
drivers/nvme/target/fabrics-cmd.c