git: e0649a35a670 - main - libnvmf: Zero controller data template for I/O controllers

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Fri, 19 Jul 2024 21:06:55 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=e0649a35a670c4b625d1de289b3886d9b3c9654f

commit e0649a35a670c4b625d1de289b3886d9b3c9654f
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-07-19 21:06:47 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-07-19 21:06:47 +0000

    libnvmf: Zero controller data template for I/O controllers
    
    This prevents stack garbage from leaking into the cdata used for the
    userspace I/O controller in nvmfd(8).
    
    Sponsored by:   Chelsio Communications
---
 lib/libnvmf/nvmf_controller.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/libnvmf/nvmf_controller.c b/lib/libnvmf/nvmf_controller.c
index 554e5e769ded..0e0126040ee4 100644
--- a/lib/libnvmf/nvmf_controller.c
+++ b/lib/libnvmf/nvmf_controller.c
@@ -425,6 +425,7 @@ nvmf_init_io_controller_data(struct nvmf_qpair *qp, const char *serial,
 
 	uname(&utsname);
 
+	memset(cdata, 0, sizeof(*cdata));
 	_nvmf_init_io_controller_data(qp->nq_cntlid, na->na_params.max_io_qsize,
 	    serial, utsname.sysname, utsname.release, subnqn, nn, ioccsz,
 	    sizeof(struct nvme_completion), cdata);