[PATCH] mm: bugfix: set current->reclaim_state to NULL whilereturning from kswapd()

From: Aaditya Kumar
Date: Mon Nov 05 2012 - 15:13:04 EST


From: Takamori Yamaguchi <takamori.yamaguchi@xxxxxxxxxxx>

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@xxxxxxxxxxx>
Signed-off-by: Aaditya Kumar <aaditya.kumar@xxxxxxxxxxx>

---
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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/