Commit 369b8f5a authored by Nick Piggin's avatar Nick Piggin Committed by Linus Torvalds

mm: fix XIP file writes

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: default avatarNick Piggin <npiggin@suse.de>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: default avatarCarsten Otte <cotte@de.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 4670df83
...@@ -314,7 +314,7 @@ __xip_file_write(struct file *filp, const char __user *buf, ...@@ -314,7 +314,7 @@ __xip_file_write(struct file *filp, const char __user *buf,
fault_in_pages_readable(buf, bytes); fault_in_pages_readable(buf, bytes);
kaddr = kmap_atomic(page, KM_USER0); kaddr = kmap_atomic(page, KM_USER0);
copied = bytes - copied = bytes -
__copy_from_user_inatomic_nocache(kaddr, buf, bytes); __copy_from_user_inatomic_nocache(kaddr + offset, buf, bytes);
kunmap_atomic(kaddr, KM_USER0); kunmap_atomic(kaddr, KM_USER0);
flush_dcache_page(page); flush_dcache_page(page);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment