Skip to content

Commit

Permalink
MFC r342857:
Browse files Browse the repository at this point in the history
Avoid overfow in vtruncbuf()

Using daddr_t instead of int avoids trunclbn to become negative when it
shouldn't.
This isssue was found by running syzkaller.

Reviewed by:		mckusick, kib, markj
Differential Revision:	https://reviews.freebsd.org/D18763
  • Loading branch information
tuexen committed Jan 25, 2019
1 parent 0459430 commit 5dafae6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sys/kern/vfs_subr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1858,7 +1858,7 @@ vtruncbuf(struct vnode *vp, struct ucred *cred, off_t length, int blksize)
{
struct buf *bp, *nbp;
int anyfreed;
int trunclbn;
daddr_t trunclbn;
struct bufobj *bo;

CTR5(KTR_VFS, "%s: vp %p with cred %p and block %d:%ju", __func__,
Expand Down

0 comments on commit 5dafae6

Please sign in to comment.