mirror of
https://github.com/drasko/codezero.git
synced 2026-05-04 01:21:30 +02:00
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:
@@ -192,7 +192,8 @@ void *do_mmap(struct vm_file *mapfile, unsigned long file_offset,
|
|||||||
return PTR_ERR(err);
|
return PTR_ERR(err);
|
||||||
|
|
||||||
/* For valid regions that aren't allocated by us, create the vma. */
|
/* 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);
|
return PTR_ERR(-ENOMEM);
|
||||||
|
|
||||||
/* Attach the file as the first vm object of this vma */
|
/* Attach the file as the first vm object of this vma */
|
||||||
|
|||||||
Reference in New Issue
Block a user