From: Christoph Lameter Date: Fri, 31 Aug 2007 07:12:08 +0000 (-0700) Subject: Page migration: Do not accept invalid nodes in the target nodeset X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3b42d28b2a04b3c9830eb865288239d45eccc402;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git Page migration: Do not accept invalid nodes in the target nodeset Page migration currently does not check if the target of the move contains nodes that that are invalid (if root attempts to migrate pages) and may try to allocate from invalid nodes if these are specified leading to oopses. Return -EINVAL if an offline node is specified. Signed-off-by: Christoph Lameter Cc: Shaohua Li Cc: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 172abffeb2e3..bb54b88c3d5a 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -955,6 +955,11 @@ asmlinkage long sys_migrate_pages(pid_t pid, unsigned long maxnode, goto out; } + if (!nodes_subset(new, node_online_map)) { + err = -EINVAL; + goto out; + } + err = security_task_movememory(task); if (err) goto out;