]> err.no Git - linux-2.6/commitdiff
mm: fix XIP file writes
authorNick Piggin <npiggin@suse.de>
Wed, 5 Dec 2007 07:45:25 +0000 (23:45 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Wed, 5 Dec 2007 17:21:20 +0000 (09:21 -0800)
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 <npiggin@suse.de>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: Carsten Otte <cotte@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/filemap_xip.c

index 32132f3cd641a9bdea85c101aebfb51315ee0456..e233fff61b4bd036382a26811849653ebfd4b9e5 100644 (file)
@@ -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);