Skip to content

Commit

Permalink
OpenZFS: Ensure that zfs_getattr() initializes the va_rdev field
Browse files Browse the repository at this point in the history
Otherwise the field is left uninitialized, leading to a possible kernel
memory disclosure to userspace or to the network.  Use the same
initialization value we use in zfsctl_common_getattr().

Reported-by: KMSAN
Sponsored-by: The FreeBSD Foundation
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Ed Maste <[email protected]>
Signed-off-by: Mark Johnston <[email protected]>

(cherry picked from commit 11656234b560c401dec6a16e1bf048b20fd31aac)
(cherry picked from commit af1e8b52d26502bac9a2484b87d1879334debd67)

Differential Revision:	https://reviews.freebsd.org/D42987
  • Loading branch information
markjdb authored and laffer1 committed Dec 12, 2023
1 parent 2597d61 commit 23b7e67
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
Original file line number Diff line number Diff line change
Expand Up @@ -2735,6 +2735,8 @@ zfs_getattr(vnode_t *vp, vattr_t *vap, int flags, cred_t *cr,
#else
if (vp->v_type == VBLK || vp->v_type == VCHR)
vap->va_rdev = zfs_cmpldev(rdev);
else
vap->va_rdev = 0;
#endif
vap->va_seq = zp->z_seq;
vap->va_flags = 0; /* FreeBSD: Reset chflags(2) flags. */
Expand Down

0 comments on commit 23b7e67

Please sign in to comment.