projects/linux·commit 369b8f5a

mm: fix XIP file writes

369b8f5a · Nick Piggin <[email protected]> · 2007-12-04 23:45:25 -08:00

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]>
Commit
369b8f5a70402d9fe77006cd0044c8a3fcd08430
Parents
4670df83

Changes

1 files changed · +1 −1

FileStatusAddDelContent
mm/filemap_xip.cmodified+1−1View file

mm/filemap_xip.c

View file
diff --git a/mm/filemap_xip.c b/mm/filemap_xip.c
index 32132f3..e233fff 100644
--- a/mm/filemap_xip.c
+++ b/mm/filemap_xip.c
@@ -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);