From: Wen Congyang Date: Fri, 7 Sep 2012 00:17:42 +0000 (+1000) Subject: memory hotplug: reset pgdat->kswapd to NULL if creating kernel thread fails X-Git-Tag: next-20120910~2^2~243 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=139ec1bdcc2fd2326556cb7b2e2ee6b8b158f820;p=karo-tx-linux.git memory hotplug: reset pgdat->kswapd to NULL if creating kernel thread fails If kthread_run() fails, pgdat->kswapd contains errno. When we stop this thread, we only check whether pgdat->kswapd is NULL and access it. If it contains errno, it will cause page fault. Reset pgdat->kswapd to NULL when creating kernel thread fails can avoid this problem. Signed-off-by: Wen Congyang Reviewed-by: Minchan Kim Signed-off-by: Andrew Morton --- diff --git a/mm/vmscan.c b/mm/vmscan.c index 8d01243d9560..99b434b674c0 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -3102,6 +3102,7 @@ int kswapd_run(int nid) /* failure at boot is fatal */ BUG_ON(system_state == SYSTEM_BOOTING); printk("Failed to start kswapd on node %d\n",nid); + pgdat->kswapd = NULL; ret = -1; } return ret;