git: 7a9bc8a82ec2 - main - nfssvc: Zero the buffer copied out when NFSSVC_DUMPMNTOPTS is set

Mark Johnston markj at FreeBSD.org
Fri Jul 16 02:42:31 UTC 2021


The branch main has been updated by markj:

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

commit 7a9bc8a82ec20f9208643f1615ea4ca1d0e5d933
Author:     Mark Johnston <markj at FreeBSD.org>
AuthorDate: 2021-07-16 02:39:27 +0000
Commit:     Mark Johnston <markj at FreeBSD.org>
CommitDate: 2021-07-16 02:41:10 +0000

    nfssvc: Zero the buffer copied out when NFSSVC_DUMPMNTOPTS is set
    
    Reported by:    KMSAN
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
---
 sys/fs/nfsclient/nfs_clport.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/fs/nfsclient/nfs_clport.c b/sys/fs/nfsclient/nfs_clport.c
index 90d403334155..5c79e3ac6960 100644
--- a/sys/fs/nfsclient/nfs_clport.c
+++ b/sys/fs/nfsclient/nfs_clport.c
@@ -1312,7 +1312,8 @@ nfssvc_nfscl(struct thread *td, struct nfssvc_args *uap)
 			error = EINVAL;
 		}
 		if (error == 0) {
-			buf = malloc(dumpmntopts.ndmnt_blen, M_TEMP, M_WAITOK);
+			buf = malloc(dumpmntopts.ndmnt_blen, M_TEMP, M_WAITOK |
+			    M_ZERO);
 			nfscl_retopts(VFSTONFS(nd.ni_vp->v_mount), buf,
 			    dumpmntopts.ndmnt_blen);
 			vput(nd.ni_vp);


More information about the dev-commits-src-main mailing list