]> git.baikalelectronics.ru Git - kernel.git/commit
do_wp_page: fix regression with execute in place
authorCarsten Otte <cotte@de.ibm.com>
Wed, 4 Feb 2009 23:12:16 +0000 (15:12 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 5 Feb 2009 20:56:48 +0000 (12:56 -0800)
commitdb1c82a543a98521a4ecd1872de02da2c33089b4
tree3ed67a71d7cce6dbd5b6bd559966f7fc137c8f00
parent43cf73bac7b13a7cb78b9378e50c2572ba361445
do_wp_page: fix regression with execute in place

Fix do_wp_page for VM_MIXEDMAP mappings.

In the case where pfn_valid returns 0 for a pfn at the beginning of
do_wp_page and the mapping is not shared writable, the code branches to
label `gotten:' with old_page == NULL.

In case the vma is locked (vma->vm_flags & VM_LOCKED), lock_page,
clear_page_mlock, and unlock_page try to access the old_page.

This patch checks whether old_page is valid before it is dereferenced.

The regression was introduced by "mlock: mlocked pages are unevictable"
(commit fb3c7723b055f0bb8948a7c4561fc3dca27df23c).

Signed-off-by: Carsten Otte <cotte@de.ibm.com>
Cc: Nick Piggin <npiggin@suse.de>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: <stable@kernel.org> [2.6.28.x]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/memory.c