Commit 9b74fe51 authored by Jinjiang Tu's avatar Jinjiang Tu
Browse files

mm/oom_kill: fix NULL pointer dereference in memcg_print_bad_task()

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8WVL2


CVE: NA

--------------------------------

When memcg oom occurs, commit be8d9553 ("memcg: support priority
for oom") calls memcg_print_bad_task() to print oc->chosen when
the chosen task comes from low-priority memcg. oc->chosen may be
assigned with -1 in oom_evaluate_task(). Howerver, memcg_print_bad_task()
does't check if oc->chosen is -1 and leads to NULL pointer dereference.

To fix it, check if oc->chosen is -1 in memcg_print_bad_task().

Fixes: be8d9553 ("memcg: support priority for oom")
Signed-off-by: default avatarJinjiang Tu <tujinjiang@huawei.com>
parent 806899e4
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment