git: 33ce17883506 - main - vn_bmap_seekhole: check that passed offset is non-negative

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Wed, 19 Oct 2022 17:24:20 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=33ce1788350612f4143be6837b74f77e29329fd9

commit 33ce1788350612f4143be6837b74f77e29329fd9
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-10-17 15:29:38 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-10-19 17:24:07 +0000

    vn_bmap_seekhole: check that passed offset is non-negative
    
    Reviewed by:    markj
    Tested by:      pho
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D37024
---
 sys/kern/vfs_vnops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index 1c7db3852776..8eaf23d91d4d 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -2576,7 +2576,7 @@ vn_bmap_seekhole_locked(struct vnode *vp, u_long cmd, off_t *off,
 	if (error != 0)
 		goto out;
 	noff = *off;
-	if (noff >= va.va_size) {
+	if (noff < 0 || noff >= va.va_size) {
 		error = ENXIO;
 		goto out;
 	}