Skip to content

Commit

Permalink
vfs: Fix error handling in vn_fullpath_hardlink()
Browse files Browse the repository at this point in the history
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
  • Loading branch information
markjdb committed May 11, 2021
1 parent 630caa9 commit c8bbb12
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sys/kern/vfs_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit c8bbb12

Please sign in to comment.