Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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;