Skip to content

Commit

Permalink
mm: fix XIP file writes
Browse files Browse the repository at this point in the history
Writing to XIP files at a non-page-aligned offset results in data corruption
because the writes were always sent to the start of the page.

Signed-off-by: Nick Piggin <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Acked-by: Carsten Otte <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Nick Piggin authored and Linus Torvalds committed Dec 5, 2007
1 parent 4670df8 commit 369b8f5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/filemap_xip.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ __xip_file_write(struct file *filp, const char __user *buf,
fault_in_pages_readable(buf, bytes);
kaddr = kmap_atomic(page, KM_USER0);
copied = bytes -
__copy_from_user_inatomic_nocache(kaddr, buf, bytes);
__copy_from_user_inatomic_nocache(kaddr + offset, buf, bytes);
kunmap_atomic(kaddr, KM_USER0);
flush_dcache_page(page);

Expand Down

0 comments on commit 369b8f5

Please sign in to comment.