Commit 12326136 authored by Zheng Yejian's avatar Zheng Yejian Committed by Zheng Zengkai
Browse files

livepatch/core: Fix where module get and put in different macro

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



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

Refer to following function procedure, 'obj->mod' is got if not define
CONFIG_LIVEPATCH_FTRACE, but it is put if define
CONFIG_LIVEPATCH_STOP_MACHINE_CONSISTENCY. If enable state of these two
macros changed, reference count of 'obj->mod' would be wrong.

  klp_register_patch
      klp_init_patch
          klp_init_object
              klp_find_object_module
                  try_module_get    <-- !CONFIG_LIVEPATCH_FTRACE
              module_put  <-- CONFIG_LIVEPATCH_STOP_MACHINE_CONSISTENCY
      klp_free_patch_start
          klp_free_objects
              __klp_free_objects
                  module_put <-- CONFIG_LIVEPATCH_STOP_MACHINE_CONSISTENCY

So we use CONFIG_LIVEPATCH_STOP_MACHINE_CONSISTENCY uniformly.

Fixes: c33e4283 ("livepatch/core: Allow implementation without ftrace")
Signed-off-by: default avatarZheng Yejian <zhengyejian1@huawei.com>
Reviewed-by: default avatarXu Kuohai <xukuohai@huawei.com>
Reviewed-by: default avatarCheng Jian <cj.chengjian@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent 70e6a87c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment