[PATCH 2/4] pfnmap: cow_user_page needs mask
From: Hugh Dickins
Date: Tue Nov 29 2005 - 11:53:12 EST
The fault address to cow_user_page is not usually page aligned, so needs
to be masked in the unusual case when that copies via the user address.
Signed-off-by: Hugh Dickins <hugh@xxxxxxxxxxx>
---
mm/memory.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletion(-)
--- 2.6.15-rc3/mm/memory.c 2005-11-29 08:40:07.000000000 +0000
+++ linux/mm/memory.c 2005-11-29 15:59:34.000000000 +0000
@@ -1300,7 +1313,8 @@ static inline void cow_user_page(struct
*/
if (unlikely(!src)) {
void *kaddr = kmap_atomic(dst, KM_USER0);
- unsigned long left = __copy_from_user_inatomic(kaddr, (void __user *)va, PAGE_SIZE);
+ unsigned long left = __copy_from_user_inatomic(kaddr,
+ (void __user *)(va & PAGE_MASK), PAGE_SIZE);
if (left)
memset(kaddr, 0, PAGE_SIZE);
kunmap_atomic(kaddr, KM_USER0);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/