提交 70e6a87c 编写于 作者: Z Zheng Yejian 提交者: Zheng Zengkai

livepatch/core: Remove redundant klp_free_objects_mod_limited

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I4SFHQ

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

Refer to following function procedure, klp_free_objects_mod_limited
seems redundant, so remove it:
  klp_register_patch
      klp_init_patch
          klp_init_object             <---
              klp_find_object_module      \
                  try_module_get           |<-- 1. If something wrong here
          jump_label_register         <----
          klp_free_objects_mod_limited    <-- 2. Check and put 'obj->mod'
              module_put
      klp_free_patch_start    <-- 3. Check and put 'obj->mod' again
          klp_free_objects
              __klp_free_objects
                  module_put
Signed-off-by: NZheng Yejian <zhengyejian1@huawei.com>
Reviewed-by: NXu Kuohai <xukuohai@huawei.com>
Reviewed-by: NCheng Jian <cj.chengjian@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 a891dbbe
...@@ -1185,23 +1185,6 @@ static int klp_init_patch_early(struct klp_patch *patch) ...@@ -1185,23 +1185,6 @@ static int klp_init_patch_early(struct klp_patch *patch)
return 0; return 0;
} }
#ifdef CONFIG_LIVEPATCH_STOP_MACHINE_CONSISTENCY
static void klp_free_objects_mod_limited(struct klp_patch *patch,
struct klp_object *limit)
{
struct klp_object *obj, *tmp_obj;
klp_for_each_object_safe(patch, obj, tmp_obj) {
if (limit == obj)
break;
if (klp_is_module(obj) && obj->mod) {
module_put(obj->mod);
obj->mod = NULL;
}
}
}
#endif
static int klp_init_patch(struct klp_patch *patch) static int klp_init_patch(struct klp_patch *patch)
{ {
struct klp_object *obj; struct klp_object *obj;
...@@ -1220,7 +1203,7 @@ static int klp_init_patch(struct klp_patch *patch) ...@@ -1220,7 +1203,7 @@ static int klp_init_patch(struct klp_patch *patch)
klp_for_each_object(patch, obj) { klp_for_each_object(patch, obj) {
ret = klp_init_object(patch, obj); ret = klp_init_object(patch, obj);
if (ret) if (ret)
goto out; return ret;
} }
flush_module_icache(patch->mod); flush_module_icache(patch->mod);
...@@ -1230,7 +1213,7 @@ static int klp_init_patch(struct klp_patch *patch) ...@@ -1230,7 +1213,7 @@ static int klp_init_patch(struct klp_patch *patch)
ret = jump_label_register(patch->mod); ret = jump_label_register(patch->mod);
if (ret) { if (ret) {
module_enable_ro(patch->mod, true); module_enable_ro(patch->mod, true);
goto out; return ret;
} }
module_enable_ro(patch->mod, true); module_enable_ro(patch->mod, true);
...@@ -1242,11 +1225,6 @@ static int klp_init_patch(struct klp_patch *patch) ...@@ -1242,11 +1225,6 @@ static int klp_init_patch(struct klp_patch *patch)
list_add_tail(&patch->list, &klp_patches); list_add_tail(&patch->list, &klp_patches);
return 0; return 0;
out:
#ifdef CONFIG_LIVEPATCH_STOP_MACHINE_CONSISTENCY
klp_free_objects_mod_limited(patch, obj);
#endif
return ret;
} }
#ifdef CONFIG_LIVEPATCH_PER_TASK_CONSISTENCY #ifdef CONFIG_LIVEPATCH_PER_TASK_CONSISTENCY
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册