[PATCH 2/4] pfnmap: cow_user_page needs mask

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <[email protected]>
---

 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux