summaryrefslogtreecommitdiffstats
path: root/sys/vm
diff options
context:
space:
mode:
authordillon <dillon@FreeBSD.org>2001-11-05 18:58:47 +0000
committerdillon <dillon@FreeBSD.org>2001-11-05 18:58:47 +0000
commita08a119cfc5cdcc2e9aa2e6a8e257da8df5db914 (patch)
treeba5e3b8a064134f4c5603f9029ed25d20102e653 /sys/vm
parent094cb29b1151595b1d62c786f4f942d3a11fe157 (diff)
downloadFreeBSD-src-a08a119cfc5cdcc2e9aa2e6a8e257da8df5db914.zip
FreeBSD-src-a08a119cfc5cdcc2e9aa2e6a8e257da8df5db914.tar.gz
Adjust vnode_pager_input_smlfs() to not attempt to BMAP blocks beyond the
file EOF. This works around a bug in the ISOFS (CDRom) BMAP code which returns bogus values for requests beyond the file EOF rather then returning an error, resulting in either corrupt data being mmap()'d beyond the file EOF or resulting in a seg-fault on the last page of a mmap()'d file (mmap()s of CDRom files). Reported by: peter / Yahoo MFC after: 3 days
Diffstat (limited to 'sys/vm')
-rw-r--r--sys/vm/vnode_pager.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c
index 412bfab..9e6363b 100644
--- a/sys/vm/vnode_pager.c
+++ b/sys/vm/vnode_pager.c
@@ -422,12 +422,17 @@ vnode_pager_input_smlfs(object, m)
kva = vm_pager_map_page(m);
for (i = 0; i < PAGE_SIZE / bsize; i++) {
+ vm_ooffset_t address;
if (vm_page_bits(i * bsize, bsize) & m->valid)
continue;
- fileaddr = vnode_pager_addr(vp,
- IDX_TO_OFF(m->pindex) + i * bsize, (int *)0);
+ address = IDX_TO_OFF(m->pindex) + i * bsize;
+ if (address >= object->un_pager.vnp.vnp_size) {
+ fileaddr = -1;
+ } else {
+ fileaddr = vnode_pager_addr(vp, address, NULL);
+ }
if (fileaddr != -1) {
bp = getpbuf(&vnode_pbuf_freecnt);
OpenPOWER on IntegriCloud