From f3019115441becf23db37e7267de4112e7ede5f6 Mon Sep 17 00:00:00 2001 From: Cheng Jian Date: Sat, 11 May 2019 10:52:53 +0800 Subject: [PATCH] livepatch/arm64: use WARN_ON() for arch_klp_unpatch_func errors hulk inclusion category: bugfix bugzilla: 5507 CVE: NA ---------------------------------------------- BUG_ON will cause the kernel to crash, using WARN_ON instead. Signed-off-by: Cheng Jian Reviewed-by: Hanjun Guo Signed-off-by: Yang Yingliang --- arch/arm64/kernel/livepatch.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/livepatch.c b/arch/arm64/kernel/livepatch.c index 5587e646ae47..c419fb0a90e6 100644 --- a/arch/arm64/kernel/livepatch.c +++ b/arch/arm64/kernel/livepatch.c @@ -262,8 +262,11 @@ void arch_klp_unpatch_func(struct klp_func *func) int i; u32 insns[LJMP_INSN_SIZE]; #endif + func_node = klp_find_func_node(func->old_addr); - BUG_ON(!func_node); + if (WARN_ON(!func_node)) + return; + pc = func_node->old_addr; if (list_is_singular(&func_node->func_stack)) { #ifdef CONFIG_ARM64_MODULE_PLTS @@ -288,7 +291,9 @@ void arch_klp_unpatch_func(struct klp_func *func) list_del_rcu(&func->stack_node); next_func = list_first_or_null_rcu(&func_node->func_stack, struct klp_func, stack_node); - BUG_ON(!next_func); + if (WARN_ON(!next_func)) + return; + new_addr = (unsigned long)next_func->new_func; #ifdef CONFIG_ARM64_MODULE_PLTS if (offset_in_range(pc, new_addr, SZ_128M)) { -- GitLab