Commit 34176ea6 authored by Wang ShaoBo's avatar Wang ShaoBo
Browse files

Revert "arm64/mpam: Fix mpam corrupt when cpu online"

hulk inclusion
category: bugfix
bugzilla: 189067, https://gitee.com/openeuler/kernel/issues/I7PN0A


CVE: NA

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

BUG 'sleeping function called from invalid context' reported when
setup MPAM driver, it was blamed to 0f4acaeb ("arm64/mpam:
Fix mpam corrupt when cpu online"), which reported a 'Bad PC' BUG,
but missing the right conclusion, finally disabling irqs before calling
cpuhp_setup_state() may only affect the probability of reproduction.

The reason why triggerring 'Bad PC' BUG report is because mpam_enable()
is __init type function, and may schedule out after calling
__cpuhp_setup_state()->__might_sleep(), so the space of mpam_enable()
might be freed after scheduling back.

As we have changed mpam_enable() to non-init type function, we can
revert commit 0f4acaeb directly, to solve these both two problems.

Fixes: 0f4acaeb ("arm64/mpam: Fix mpam corrupt when cpu online")
Signed-off-by: default avatarWang ShaoBo <bobo.shaobowang@huawei.com>
parent 111c6eca
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -596,11 +596,9 @@ static void mpam_enable(struct work_struct *work)
		pr_err("Failed to setup/init resctrl\n");
	mutex_unlock(&mpam_devices_lock);

	local_irq_disable();
	mpam_cpuhp_state = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN,
						"mpam:online", mpam_cpu_online,
						mpam_cpu_offline);
	local_irq_enable();
	if (mpam_cpuhp_state <= 0)
		pr_err("Failed to re-register 'dyn' cpuhp callbacks");
	mutex_unlock(&mpam_cpuhp_lock);