[PATCH openEuler-1.0-LTS] jump_label: skip resource release if jump label is not relocated

From: Ye Weihua <yeweihua4@huawei.com> hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I47NHU CVE: NA -------------------------------- Before a module is deleted, the kernel traverses the jump_label section to release resources applied by each jump entry. Common modules apply for these resources before module initialization, but livepatch modules apply during livepatch redirection. Therefore, when a livepatch module fails to be inserted, the resources to be applied by jump_label are not applied. As a result, a panic occurs when a null pointer is accessed during resource release. To solve the this problem, skip resource release if jump label is not relocated. Signed-off-by: Ye Weihua <yeweihua4@huawei.com> Reviewed-by: Yang Jihong <yangjihong1@huawei.com> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> --- kernel/jump_label.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/jump_label.c b/kernel/jump_label.c index 0cf0a14969254..15c7df2065511 100644 --- a/kernel/jump_label.c +++ b/kernel/jump_label.c @@ -623,6 +623,9 @@ static void jump_label_del_module(struct module *mod) struct static_key *key = NULL; struct static_key_mod *jlm, **prev; + if (unlikely(!mod_klp_rel_completed(mod))) + return; + for (iter = iter_start; iter < iter_stop; iter++) { if (jump_entry_key(iter) == key) continue; -- 2.25.1
-
Yang Yingliang