提交 18b48d58 编写于 作者: W Wen Congyang 提交者: 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: NWen Congyang <wency@cn.fujitsu.com>
Reviewed-by: NMinchan Kim <minchan@kernel.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册