Commit b12045fb authored by Gui-Dong Han's avatar Gui-Dong Han
Browse files

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

BUAA inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I85XYM



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

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.

Signed-off-by: default avatarGui-Dong Han <hanguidong@buaa.edu.cn>
parent 9afce123
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment