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
This commit is contained in:
dillon 2001-11-05 18:58:47 +00:00
parent 094cb29b11
commit a08a119cfc

View File

@ -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);