git: 44328abfb7ac - main - nfscl: fix uninitialized memory in nfsv4_loadattr

From: Alan Somers <asomers_at_FreeBSD.org>
Date: Sun, 08 Sep 2024 23:29:18 UTC
The branch main has been updated by asomers:

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

commit 44328abfb7aca8150b07b83ff502c9185677e3fb
Author:     Alan Somers <asomers@FreeBSD.org>
AuthorDate: 2024-09-08 20:42:38 +0000
Commit:     Alan Somers <asomers@FreeBSD.org>
CommitDate: 2024-09-08 23:28:33 +0000

    nfscl: fix uninitialized memory in nfsv4_loadattr
    
    When processing an RPC response that did not include any Owner
    attribute, nfsv4_loadattr would return na_uid and na_gid uninitialized.
    The uninitialized values could then make their way into the NFS
    attribute cache via nfscl_loadattrcache.
    
    PR:             281279
    Reported by:    KMSAN
    MFC after:      2 weeks
    Reviewed by:    rmacklem
    Sponsored by:   Axcient
---
 sys/fs/nfs/nfs_commonsubs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c
index 47ab4958f9c5..90b30f462106 100644
--- a/sys/fs/nfs/nfs_commonsubs.c
+++ b/sys/fs/nfs/nfs_commonsubs.c
@@ -1322,6 +1322,7 @@ nfsv4_loadattr(struct nfsrv_descript *nd, vnode_t vp,
 		 * Just set default values to some of the important ones.
 		 */
 		if (nap != NULL) {
+			VATTR_NULL(&nap->na_vattr);
 			nap->na_type = VREG;
 			nap->na_mode = 0;
 			nap->na_rdev = (NFSDEV_T)0;