[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1465249059-7883-1-git-send-email-sudipm.mukherjee@gmail.com>
Date: Mon, 6 Jun 2016 22:37:39 +0100
From: Sudip Mukherjee <sudipm.mukherjee@...il.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
Sudip Mukherjee <sudipm.mukherjee@...il.com>
Subject: [PATCH] mm/page_owner: avoid null pointer dereference
We have dereferenced page_ext before checking it. Lets check it first
and then used it.
Signed-off-by: Sudip Mukherjee <sudip.mukherjee@...ethink.co.uk>
---
mm/page_owner.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/mm/page_owner.c b/mm/page_owner.c
index 587dcca..8fa5083 100644
--- a/mm/page_owner.c
+++ b/mm/page_owner.c
@@ -291,13 +291,15 @@ void __dump_page_owner(struct page *page)
.skip = 0
};
depot_stack_handle_t handle;
- gfp_t gfp_mask = page_ext->gfp_mask;
- int mt = gfpflags_to_migratetype(gfp_mask);
+ gfp_t gfp_mask;
+ int mt;
if (unlikely(!page_ext)) {
pr_alert("There is not page extension available.\n");
return;
}
+ gfp_mask = page_ext->gfp_mask;
+ mt = gfpflags_to_migratetype(gfp_mask);
if (!test_bit(PAGE_EXT_OWNER, &page_ext->flags)) {
pr_alert("page_owner info is not active (free page?)\n");
--
1.9.1
Powered by blists - more mailing lists