hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IDB5TR ----------------------------------------- xcu_can_attach() allocates an xcg_attach_entry via kmem_cache_zalloc() but failed to check the return value before dereferencing it. Fixes: 43bbefc53356 ("xsched: Add XCU control group implementation and its backend in xsched CFS") Signed-off-by: Liu Kai <liukai284@huawei.com> Signed-off-by: Zicheng Qu <quzicheng@huawei.com> --- kernel/xsched/cgroup.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/xsched/cgroup.c b/kernel/xsched/cgroup.c index 1507d457ef0b..450439aac9ef 100644 --- a/kernel/xsched/cgroup.c +++ b/kernel/xsched/cgroup.c @@ -360,6 +360,8 @@ static int xcu_can_attach(struct cgroup_taskset *tset) /* record entry for this task */ entry = kmem_cache_zalloc(xcg_attach_entry_cache, GFP_KERNEL); + if (!entry) + return -ENOMEM; entry->task = task; entry->old_xcg = old_xcg; entry->new_xcg = dst_xcg; -- 2.34.1