Commit 2021953e authored by Zeng Heng's avatar Zeng Heng
Browse files

x86: resctrl: Fix illegal access by the chips not having RDT

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IA7L2U



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

Before dom_data_init() initializing the monitor resource, we should check
if the msc has the ability of monitor.

If the chip not having RDT monitor function, variable idx_limit in
dom_data_init() would be set 0. rmid_ptrs points to an illegal buffer
after kcalloc() allocation, which would cause illegal access fault when
accessing.

Fixes: 13e249bf ("x86/resctrl: Move the filesystem portions of resctrl to live in '/fs/'")
Signed-off-by: default avatarZeng Heng <zengheng4@huawei.com>
parent a9d59710
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -830,13 +830,13 @@ int resctrl_mon_resource_init(void)
	struct rdt_resource *r = resctrl_arch_get_resource(RDT_RESOURCE_L3);
	int ret;

	if (!r->mon_capable)
		return 0;

	ret = dom_data_init(r);
	if (ret)
		return ret;

	if (!r->mon_capable)
		return 0;

	l3_mon_evt_init(r);

	if (resctrl_arch_is_evt_configurable(QOS_L3_MBM_TOTAL_EVENT_ID)) {