Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 May 2021 18:33:47 GMT
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 8b59c6af27d1 - stable/13 - vfs: Fix error handling in vn_fullpath_hardlink()
Message-ID:  <202105221833.14MIXlRa019456@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by mjg:

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

commit 8b59c6af27d188f6f32800a34b872c9415533895
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2021-05-11 00:18:00 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2021-05-22 18:33:16 +0000

    vfs: Fix error handling in vn_fullpath_hardlink()
    
    vn_fullpath_any_smr() will return a positive error number if the
    caller-supplied buffer isn't big enough.  In this case the error must be
    propagated up, otherwise we may copy out uninitialized bytes.
    
    Reported by:    syzkaller+KMSAN
    Reviewed by:    mjg, kib
    MFC aftr:       3 days
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D30198
    
    (cherry picked from commit c8bbb1272c8bc103cfaa42c7a1639f42b62483dd)
---
 sys/kern/vfs_cache.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c
index 2def9900096f..5b978511db17 100644
--- a/sys/kern/vfs_cache.c
+++ b/sys/kern/vfs_cache.c
@@ -3646,9 +3646,9 @@ vn_fullpath_hardlink(struct nameidata *ndp, char **retbuf, char **freebuf,
 		error = vn_fullpath_dir(vp, pwd->pwd_rdir, buf, retbuf, buflen,
 		    addend);
 		pwd_drop(pwd);
-		if (error != 0)
-			goto out_bad;
 	}
+	if (error != 0)
+		goto out_bad;
 
 	*freebuf = buf;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202105221833.14MIXlRa019456>