lmkd: Fix potential null dereference in hook call
If hooks are enabled in LMKD and kill_info is not supplied to kill_one_process, there will be a null dereference on kill_info. This changes validates ki before dereferencing. Bug: b/210075795 Test: cq Change-Id: Ie81ca9bdb73a71f16dc5682c8721a557b8b094fb Merged-In: Ie81ca9bdb73a71f16dc5682c8721a557b8b094fb
This commit is contained in:
parent
2cce3066da
commit
e9769f7cf3
2
lmkd.cpp
2
lmkd.cpp
|
|
@ -2327,7 +2327,7 @@ static int kill_one_process(struct proc* procp, int min_oom_score, struct kill_i
|
||||||
procp->oomadj, min_oom_score, ki ? ki->max_thrashing : -1);
|
procp->oomadj, min_oom_score, ki ? ki->max_thrashing : -1);
|
||||||
|
|
||||||
result = lmkd_free_memory_before_kill_hook(procp, rss_kb / page_k, min_oom_score,
|
result = lmkd_free_memory_before_kill_hook(procp, rss_kb / page_k, min_oom_score,
|
||||||
ki->kill_reason);
|
ki ? (int)ki->kill_reason : -1);
|
||||||
if (result > 0) {
|
if (result > 0) {
|
||||||
/*
|
/*
|
||||||
* Memory was freed elsewhere; no need to kill. Note: intentionally do not
|
* Memory was freed elsewhere; no need to kill. Note: intentionally do not
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue