From: Wen Congyang Date: Mon, 17 Sep 2012 21:08:55 +0000 (-0700) Subject: memory hotplug: reset pgdat->kswapd to NULL if creating kernel thread fails X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=18b48d5873a6fc8e0e6044ddb572fcda26988f19;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.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 Signed-off-by: Linus Torvalds --- diff --git a/mm/vmscan.c b/mm/vmscan.c index 8d01243d956..99b434b674c 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;