[PATCH 2/4] pfnmap: cow_user_page needs mask

From: Hugh Dickins (hugh_at_veritas.com)
Date: 11/29/05

  • Next message: Nix: "Re: Question: madvise(DONT_SYNC)"
    Date:	Tue, 29 Nov 2005 16:53:56 +0000 (GMT)
    To: Linus Torvalds <torvalds@osdl.org>
    
    

    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@veritas.com>

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

  • Next message: Nix: "Re: Question: madvise(DONT_SYNC)"