[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220418141253.24298-10-linmiaohe@huawei.com>
Date: Mon, 18 Apr 2022 22:12:50 +0800
From: Miaohe Lin <linmiaohe@...wei.com>
To: <akpm@...ux-foundation.org>
CC: <vbabka@...e.cz>, <pintu@...eaurora.org>,
<charante@...eaurora.org>, <linux-mm@...ck.org>,
<linux-kernel@...r.kernel.org>, <linmiaohe@...wei.com>
Subject: [PATCH 09/12] 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.
Signed-off-by: Miaohe Lin <linmiaohe@...wei.com>
---
mm/compaction.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
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;
}
--
2.23.0
Powered by blists - more mailing lists