Commit 84f6683f authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Liao Chen
Browse files

static_call: Replace pointless WARN_ON() in static_call_module_notify()

stable inclusion
from stable-v6.6.55
commit e67534bd31d79952b50e791e92adf0b3e6c13b8c
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IAYRDC

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=e67534bd31d79952b50e791e92adf0b3e6c13b8c



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

[ Upstream commit fe513c2ef0a172a58f158e2e70465c4317f0a9a2 ]

static_call_module_notify() triggers a WARN_ON(), when memory allocation
fails in __static_call_add_module().

That's not really justified, because the failure case must be correctly
handled by the well known call chain and the error code is passed
through to the initiating userspace application.

A memory allocation fail is not a fatal problem, but the WARN_ON() takes
the machine out when panic_on_warn is set.

Replace it with a pr_warn().

Fixes: 9183c3f9 ("static_call: Add inline static call infrastructure")
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/8734mf7pmb.ffs@tglx


Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarLiao Chen <liaochen4@huawei.com>
parent 09350f59
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -452,7 +452,7 @@ static int static_call_module_notify(struct notifier_block *nb,
	case MODULE_STATE_COMING:
		ret = static_call_add_module(mod);
		if (ret) {
			WARN(1, "Failed to allocate memory for static calls");
			pr_warn("Failed to allocate memory for static calls\n");
			static_call_del_module(mod);
		}
		break;