Commit 18b48d58 authored by Wen Congyang's avatar Wen Congyang Committed by Linus Torvalds

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: default avatarWen Congyang <wency@cn.fujitsu.com>
Reviewed-by: default avatarMinchan Kim <minchan@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 6bf61045
...@@ -3102,6 +3102,7 @@ int kswapd_run(int nid) ...@@ -3102,6 +3102,7 @@ int kswapd_run(int nid)
/* failure at boot is fatal */ /* failure at boot is fatal */
BUG_ON(system_state == SYSTEM_BOOTING); BUG_ON(system_state == SYSTEM_BOOTING);
printk("Failed to start kswapd on node %d\n",nid); printk("Failed to start kswapd on node %d\n",nid);
pgdat->kswapd = NULL;
ret = -1; ret = -1;
} }
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment