linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: bugfix: set current->reclaim_state to NULL while returning from kswapd()
@ 2012-11-05 20:13 Aaditya Kumar
  2012-11-05 21:44 ` David Rientjes
  0 siblings, 1 reply; 2+ messages in thread
From: Aaditya Kumar @ 2012-11-05 20:13 UTC (permalink / raw)
  To: LKML, linux-mm
  Cc: kosaki.motohiro, KAMEZAWA Hiroyuki, KOSAKI Motohiro, Mel Gorman,
	akpm, Minchan Kim, takamori.yamaguchi, takuzo.ohara,
	amit.agarwal, tim.bird, frank.rowand, kan.iibuchi, aaditya.kumar

From: Takamori Yamaguchi <takamori.yamaguchi@jp.sony.com>

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 off lining,
__free_slab() can access dangling pointer of current->reclaim_state.

Signed-off-by: Takamori Yamaguchi <takamori.yamaguchi@jp.sony.com>
Signed-off-by: Aaditya Kumar <aaditya.kumar@ap.sony.com>

---
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 2624edc..8b055e9 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -3017,6 +3017,8 @@ static int kswapd(void *p)
 						&balanced_classzone_idx);
 		}
 	}
+
+	current->reclaim_state = NULL;
 	return 0;
 }

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] mm: bugfix: set current->reclaim_state to NULL while returning from kswapd()
  2012-11-05 20:13 [PATCH] mm: bugfix: set current->reclaim_state to NULL while returning from kswapd() Aaditya Kumar
@ 2012-11-05 21:44 ` David Rientjes
  0 siblings, 0 replies; 2+ messages in thread
From: David Rientjes @ 2012-11-05 21:44 UTC (permalink / raw)
  To: Aaditya Kumar
  Cc: LKML, linux-mm, kosaki.motohiro, KAMEZAWA Hiroyuki,
	KOSAKI Motohiro, Mel Gorman, akpm, Minchan Kim,
	takamori.yamaguchi, takuzo.ohara, amit.agarwal, tim.bird,
	frank.rowand, kan.iibuchi, aaditya.kumar

On Tue, 6 Nov 2012, Aaditya Kumar wrote:

> From: Takamori Yamaguchi <takamori.yamaguchi@jp.sony.com>
> 
> 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 off lining,
> __free_slab() can access dangling pointer of current->reclaim_state.
> 

It's __free_slab() for slub and kmem_freepages() for slab.

> Signed-off-by: Takamori Yamaguchi <takamori.yamaguchi@jp.sony.com>
> Signed-off-by: Aaditya Kumar <aaditya.kumar@ap.sony.com>

Acked-by: David Rientjes <rientjes@google.com>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-11-05 21:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-05 20:13 [PATCH] mm: bugfix: set current->reclaim_state to NULL while returning from kswapd() Aaditya Kumar
2012-11-05 21:44 ` David Rientjes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox