livepatch/core: Fix reference count issues
hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I4SFHQ -------------------------------- Fix following reference count issues where get 'obj->mod' once but put twice: 1) klp_register_patch klp_init_patch klp_init_object klp_find_object_module try_module_get <-- 1. Get refcount once klp_init_object_loaded <-- 2. If fail here!!! module_put <-- 3. Put refcount first time klp_free_patch_start klp_free_objects __klp_free_objects module_put <-- 4. 'obj->mod' not null, put twice!!! 2) klp_register_patch klp_init_patch klp_init_object klp_find_object_module try_module_get <-- 1. Get refcount once kobject_add <-- 2. If other objs fail here!!! klp_free_objects_mod_limited module_put <-- 3. Put refcount first time klp_free_patch_start klp_free_objects __klp_free_objects module_put <-- 4. 'obj->mod' not null, put twice!!! Fixes: c33e4283 ("livepatch/core: Allow implementation without ftrace") Signed-off-by:Zheng Yejian <zhengyejian1@huawei.com> Reviewed-by:
Xu Kuohai <xukuohai@huawei.com> Reviewed-by:
Cheng Jian <cj.chengjian@huawei.com> Signed-off-by:
Zheng Zengkai <zhengzengkai@huawei.com>
Loading
Please sign in to comment