git: e758e5512005 - stable/13 - nfscl: fix uninitialized memory in nfsv4_loadattr

From: Alan Somers <asomers_at_FreeBSD.org>
Date: Mon, 20 Jan 2025 22:26:34 UTC
The branch stable/13 has been updated by asomers:

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

commit e758e5512005abdc30285e95e39f98c01ae12d85
Author:     Alan Somers <asomers@FreeBSD.org>
AuthorDate: 2024-09-08 20:42:38 +0000
Commit:     Alan Somers <asomers@FreeBSD.org>
CommitDate: 2025-01-20 22:16:11 +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
    Reviewed by:    rmacklem
    Sponsored by:   Axcient
    
    (cherry picked from commit 44328abfb7aca8150b07b83ff502c9185677e3fb)
---
 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 ebed4a4b5905..e35fd8d1185f 100644
--- a/sys/fs/nfs/nfs_commonsubs.c
+++ b/sys/fs/nfs/nfs_commonsubs.c
@@ -1280,6 +1280,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;