[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090218125649.GU7272@hack.private>
Date: Wed, 18 Feb 2009 20:56:49 +0800
From: Américo Wang <xiyou.wangcong@...il.com>
To: LKML <linux-kernel@...r.kernel.org>
Cc: linux-mm@...ck.org, Andrew Morton <akpm@...l.org>,
Nick Piggin <nickpiggin@...oo.com.au>
Subject: [Patch] mm: fix null pointer dereference in vm_normal_page()
One usage of vm_normal_page() is:
struct page *page = vm_normal_page(gate_vma, start, *pte);
where gate_vma is returned by get_gate_vma() which can be NULL.
So let vm_normal_page return NULL when vma is NULL.
Signed-off-by: WANG Cong <wangcong@...ux.org>
Cc: Nick Piggin <nickpiggin@...oo.com.au>
---
diff --git a/mm/memory.c b/mm/memory.c
index baa999e..e428aa6 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -493,6 +493,9 @@ struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr,
{
unsigned long pfn = pte_pfn(pte);
+ if (!vma)
+ return NULL;
+
if (HAVE_PTE_SPECIAL) {
if (likely(!pte_special(pte)))
goto check_pfn;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists