Unverified Commit 50eca1df authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!2333 ktask: add null-pointer checks for ktask_works in ktask_init()

Merge Pull Request from: @gemini2045 
 
Hello, I am Gui-Dong Han 
from the School of Cyber Science and Technology at Beihang University.
I discovered a possible bug using a program analysis tool,
named `BassCheck`, developed by our team.
In `ktask_init()`, the pointer `ktask_works`
is allocated using `kmalloc_array`, which can fail and return `NULL`. 
The pointer `ktask_works` is used in the following code:
`list_add_tail(&ktask_works[i].kw_list, &ktask_free_works);`
Thus, a null-pointer dereference can occur, crashing the kernel. 
To fix this bug, the pointer `ktask_works` should be checked for `NULL` 
after the call to `kmalloc_array` to avoid null-pointer dereference.
 
 
Link:https://gitee.com/openeuler/kernel/pulls/2333

 

Reviewed-by: default avatarXie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: default avatarZhang Changzhong <zhangchangzhong@huawei.com>
parents 17889f71 b12045fb
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment