From: Takamori Yamaguchi <[email protected]>
Subject: mm: bugfix: set current->reclaim_state to NULL while returning from 
kswapd()

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 <[email protected]>
Signed-off-by: Aaditya Kumar <[email protected]>
Acked-by: David Rientjes <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
---

 mm/vmscan.c |    2 ++
 1 file changed, 2 insertions(+)

diff -puN 
mm/vmscan.c~mm-bugfix-set-current-reclaim_state-to-null-while-returning-from-kswapd
 mm/vmscan.c
--- 
a/mm/vmscan.c~mm-bugfix-set-current-reclaim_state-to-null-while-returning-from-kswapd
+++ a/mm/vmscan.c
@@ -3017,6 +3017,8 @@ static int kswapd(void *p)
                                                &balanced_classzone_idx);
                }
        }
+
+       current->reclaim_state = NULL;
        return 0;
 }
 
_
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to