Commit 0b9cb1a0 authored by Junhao He's avatar Junhao He Committed by Ma Wupeng
Browse files

drivers/perf: hisi: add NULL check for name

mainline inclusion
from mainline-v6.4-rc1
commit 257aedb7
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I77IH6
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=257aedb72e731082ab514058e57b132f0b29d707



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

When allocations fails that can be NULL now.

If the name provided is NULL, then the initialization process of the PMU
type and dev will be skipped in function perf_pmu_register().
Consequently, the PMU will not be able to register into the kernel.
Moreover, in the case of unregister the PMU, the function device_del()
will need to handle NULL pointers, which potentially can cause issues.

So move this allocation above the cpuhp_state_add_instance() and directly
return if it does fail.

Signed-off-by: default avatarJunhao He <hejunhao3@huawei.com>
parent 29bcf6cd
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment