Fix to do_mmap(): file_offset was byte offset, it is now a pfn.

Uncovered a mmap() bug that came along this far. file_offset
parameter of do_mmap() was assigned to the mapped vma as is, i.e.
as a byte offset. This caused problems since most page fault and
other internal code assumed this was a page frame number. This is now
fixed. This came along unnoticed since all mmaps until now started at
file offset 0.
This commit is contained in:
Bahadir Balban
2008-11-23 23:24:03 +02:00
parent d0e878b32c
commit 0ddb8ea799

View File

@@ -192,7 +192,8 @@ void *do_mmap(struct vm_file *mapfile, unsigned long file_offset,
return PTR_ERR(err);
/* For valid regions that aren't allocated by us, create the vma. */
if (!(new = vma_new(__pfn(map_address), npages, flags, file_offset)))
if (!(new = vma_new(__pfn(map_address), npages, flags,
__pfn(file_offset))))
return PTR_ERR(-ENOMEM);
/* Attach the file as the first vm object of this vma */