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.
Fixes: 13e249bf4944 ("x86/resctrl: Move the filesystem portions of resctrl to live in '/fs/'") 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 fcf2ab18966f..6f93ed1681c4 100644 --- a/fs/resctrl/monitor.c +++ b/fs/resctrl/monitor.c @@ -727,6 +727,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;