diff options
author | Miaohe Lin <linmiaohe@huawei.com> | 2022-04-29 08:16:18 +0200 |
---|---|---|
committer | akpm <akpm@linux-foundation.org> | 2022-04-29 08:16:18 +0200 |
commit | 3109de308987ceae413ee015038d51e2a86c7806 (patch) | |
tree | 675ccc19df04779c892c3d9e25eb5e86bbc3d388 /mm/compaction.c | |
parent | mm: compaction: clean up comment about async compaction in isolate_migratepages (diff) | |
download | linux-3109de308987ceae413ee015038d51e2a86c7806.tar.xz linux-3109de308987ceae413ee015038d51e2a86c7806.zip |
mm: compaction: avoid possible NULL pointer dereference in kcompactd_cpu_online
It's possible that kcompactd_run could fail to run kcompactd for a hot
added node and leave pgdat->kcompactd as NULL. So pgdat->kcompactd should
be checked here to avoid possible NULL pointer dereference.
Link: https://lkml.kernel.org/r/20220418141253.24298-10-linmiaohe@huawei.com
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Cc: Charan Teja Kalla <charante@codeaurora.org>
Cc: David Hildenbrand <david@redhat.com>
Cc: Pintu Kumar <pintu@codeaurora.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/compaction.c')
-rw-r--r-- | mm/compaction.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/mm/compaction.c b/mm/compaction.c index 562f274b2c51..82c54d70a978 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -3052,7 +3052,8 @@ static int kcompactd_cpu_online(unsigned int cpu) if (cpumask_any_and(cpu_online_mask, mask) < nr_cpu_ids) /* One of our CPUs online: restore mask */ - set_cpus_allowed_ptr(pgdat->kcompactd, mask); + if (pgdat->kcompactd) + set_cpus_allowed_ptr(pgdat->kcompactd, mask); } return 0; } |