git: 4421ce1328df - stable/14 - nfscl: fix uninitialized memory in nfsv4_loadattr

From: Alan Somers <asomers_at_FreeBSD.org>
Date: Thu, 10 Oct 2024 19:11:25 UTC
The branch stable/14 has been updated by asomers:

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

commit 4421ce1328dff275ae522222010b6b3b791730e7
Author:     Alan Somers <asomers@FreeBSD.org>
AuthorDate: 2024-09-08 20:42:38 +0000
Commit:     Alan Somers <asomers@FreeBSD.org>
CommitDate: 2024-10-10 19:08:12 +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 f2305795e53e..9f0e98bc93ce 100644
--- a/sys/fs/nfs/nfs_commonsubs.c
+++ b/sys/fs/nfs/nfs_commonsubs.c
@@ -1320,6 +1320,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;