static_call: Replace pointless WARN_ON() in static_call_module_notify()
PATCH 1/1 static_call: Replace pointless WARN_ON() in static_call_module_notify()
From: Thomas Gleixner <[email protected]>
commit fe513c2ef0a172a58f158e2e70465c4317f0a9a2 upstream.
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().
---
Backport to fix CVE-2024-49954
--- kernel/static_call.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/static_call.c +1 -1
@@ -431,7 +431,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 ;
Signature · 1 line
2.43.0
Sasha Levin
maintainer[ Sasha's backport helper bot ]
Hi,
The upstream commit SHA1 provided is correct: fe513c2ef0a172a58f158e2e70465c4317f0a9a2
WARNING: Author mismatch between patch and upstream commit:
Backport author: Alexey Nepomnyashih<[email protected]> Commit author: Thomas Gleixner<[email protected]>
Status in newer kernel trees:
6.12.y | Present (exact SHA1)
6.6.y | Present (different SHA1: e67534bd31d7) 6.1.y | Present (different SHA1: ea2cdf4da093) 5.15.y | Present (different SHA1: bc9356513d56) 5.10.y | Not found
Note: The patch differs from the upstream commit:
---
1: fe513c2ef0a17 ! 1: 1f8efe18f8487 static_call: Replace pointless WARN_ON() in static_call_module_notify()
@@ Metadata
## Commit message ##
static_call: Replace pointless WARN_ON() in static_call_module_notify()
+ commit fe513c2ef0a172a58f158e2e70465c4317f0a9a2 upstream.
+
static_call_module_notify() triggers a WARN_ON(), when memory allocation fails in __static_call_add_module().
@@ Commit message
+ Signed-off-by: Alexey Nepomnyashih <[email protected]>
- ## kernel/static_call_inline.c ##
-@@ kernel/static_call_inline.c: static int static_call_module_notify(struct notifier_block *nb,
+ ## kernel/static_call.c ##
+@@ kernel/static_call.c: static int static_call_module_notify(struct notifier_block *nb,
case MODULE_STATE_COMING:
ret = static_call_add_module(mod);
if (ret) {
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | stable/linux-5.10.y | Success | Success |