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

!2330 Add a check of uvhub_mask in init_per_cpu()

Merge Pull Request from: @amon-s1eepy 
 
Hello, I am Zheng Haoran from School of Cyber Science and Technology in Beihang University. I find a possible bug, using a program analysis tool named BassCheck developed by our team.

In init_per_cpu(), uvhub_mask is allocated using kzalloc(GFP_KERNEL), which can fail and return NULL. Then uvhub_mask is used in the call to get_cpu_topology(uvhub_mask). In this function, uvhub_mask is used in the following code:
```
*(uvhub_mask + (uvhub/8)) |= (1 << (uvhub%8));
```
Thus, a null-pointer dereference can occur to crash the kernel. To fix this possible bug, uvhub_mask should be checked after the call to kzalloc(GFP_KERNEL). 
 
Link:https://gitee.com/openeuler/kernel/pulls/2330

 

Reviewed-by: default avatarWei Li <liwei391@huawei.com>
Signed-off-by: default avatarZhang Changzhong <zhangchangzhong@huawei.com>
parents 1977e125 8553763e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment