hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IA7L2U
---------------------------
If the chip not having RDT function, resctrl_arch_system_num_rmid_idx() would return 0. rmid_ptrs points to an illegal buffer after kcalloc() allocation, which would cause illegal access fault when accessing.
Consequently, when we found resctrl_arch_system_num_rmid_idx() return 0, just return EOPNOTSUPP immediatly and skip initializing the resctrl file system.
Signed-off-by: Zeng Heng zengheng4@huawei.com --- fs/resctrl/monitor.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c index 6ef878f5afdd..a7bd84f9a440 100644 --- a/fs/resctrl/monitor.c +++ b/fs/resctrl/monitor.c @@ -728,6 +728,9 @@ static int dom_data_init(struct rdt_resource *r) int err = 0, i; u32 idx;
+ if (!idx_limit) + return -EOPNOTSUPP; + mutex_lock(&rdtgroup_mutex); if (IS_ENABLED(CONFIG_RESCTRL_RMID_DEPENDS_ON_CLOSID)) { u32 *tmp;