From: Takamori Yamaguchi Date: Thu, 8 Nov 2012 23:53:39 +0000 (-0800) Subject: mm: bugfix: set current->reclaim_state to NULL while returning from kswapd() X-Git-Tag: v3.4.20~170 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3f874ecc49208f3635e29c3a08ade01778ad85e4;p=platform%2Fkernel%2Flinux-stable.git mm: bugfix: set current->reclaim_state to NULL while returning from kswapd() commit b0a8cc58e6b9aaae3045752059e5e6260c0b94bc upstream. In kswapd(), set current->reclaim_state to NULL before returning, as current->reclaim_state holds reference to variable on kswapd()'s stack. In rare cases, while returning from kswapd() during memory offlining, __free_slab() and freepages() can access the dangling pointer of current->reclaim_state. Signed-off-by: Takamori Yamaguchi Signed-off-by: Aaditya Kumar Acked-by: David Rientjes Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- diff --git a/mm/vmscan.c b/mm/vmscan.c index e989ee2..e6ca505 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -3128,6 +3128,8 @@ static int kswapd(void *p) &balanced_classzone_idx); } } + + current->reclaim_state = NULL; return 0; }