git: b798b4e3d4d6 - stable/13 - vn_bmap_seekhole: check that passed offset is non-negative

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Wed, 26 Oct 2022 00:44:04 UTC
The branch stable/13 has been updated by kib:

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

commit b798b4e3d4d634d21ce6f28f9cb807ec63fd9f6e
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-10-17 15:29:38 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-10-26 00:43:43 +0000

    vn_bmap_seekhole: check that passed offset is non-negative
    
    (cherry picked from commit 33ce1788350612f4143be6837b74f77e29329fd9)
---
 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 190a48291517..b71d37820b0c 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -2565,7 +2565,7 @@ vn_bmap_seekhole(struct vnode *vp, u_long cmd, off_t *off, struct ucred *cred)
 	if (error != 0)
 		goto unlock;
 	noff = *off;
-	if (noff >= va.va_size) {
+	if (noff < 0 || noff >= va.va_size) {
 		error = ENXIO;
 		goto unlock;
 	}