diff --git a/mm/memory.c b/mm/memory.c index 22bfa7a47a0b613cf9c39ee6e7d24f7dc3c9cf77..baa999e87cd21d2f9e67c8e3b1093bb6831513fb 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -1999,7 +1999,7 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, * Don't let another task, with possibly unlocked vma, * keep the mlocked page. */ - if (vma->vm_flags & VM_LOCKED) { + if ((vma->vm_flags & VM_LOCKED) && old_page) { lock_page(old_page); /* for LRU manipulation */ clear_page_mlock(old_page); unlock_page(old_page);