git: 1c23f70aeb29 - stable/13 - pgcache read: protect against reads past end of the vm object size
Konstantin Belousov
kib at FreeBSD.org
Tue Feb 23 09:09:51 UTC 2021
The branch stable/13 has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=1c23f70aeb299e672a4fc483c45c721548ae1047
commit 1c23f70aeb299e672a4fc483c45c721548ae1047
Author: Konstantin Belousov <kib at FreeBSD.org>
AuthorDate: 2021-02-15 03:34:06 +0000
Commit: Konstantin Belousov <kib at FreeBSD.org>
CommitDate: 2021-02-23 08:50:22 +0000
pgcache read: protect against reads past end of the vm object size
PR: 253158
(cherry picked from commit c61fae1475f1864dc4bba667b642f279afd44855)
---
sys/kern/vfs_vnops.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index 6c6727c7f372..1e52a797a1f7 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -951,6 +951,10 @@ vn_read_from_obj(struct vnode *vp, struct uio *uio)
#else
vsz = atomic_load_64(&obj->un_pager.vnp.vnp_size);
#endif
+ if (uio->uio_offset >= vsz) {
+ error = EJUSTRETURN;
+ goto out;
+ }
if (uio->uio_offset + resid > vsz)
resid = vsz - uio->uio_offset;
More information about the dev-commits-src-all
mailing list