summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kernel/livepatch/core.c4
-rw-r--r--kernel/livepatch/core.h8
2 files changed, 6 insertions, 6 deletions
diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
index cafb5a84417d..eb134479c394 100644
--- a/kernel/livepatch/core.c
+++ b/kernel/livepatch/core.c
@@ -894,9 +894,7 @@ int klp_module_coming(struct module *mod)
pr_warn("failed to apply patch '%s' to module '%s' (%d)\n",
patch->mod->name, obj->mod->name, ret);
- if (patch != klp_transition_patch)
- klp_post_unpatch_callback(obj);
-
+ klp_post_unpatch_callback(obj);
goto err;
}
diff --git a/kernel/livepatch/core.h b/kernel/livepatch/core.h
index 6fc907b54e71..cc3aa708e0b4 100644
--- a/kernel/livepatch/core.h
+++ b/kernel/livepatch/core.h
@@ -12,10 +12,10 @@ static inline bool klp_is_object_loaded(struct klp_object *obj)
static inline int klp_pre_patch_callback(struct klp_object *obj)
{
- int ret;
+ int ret = 0;
- ret = (obj->callbacks.pre_patch) ?
- (*obj->callbacks.pre_patch)(obj) : 0;
+ if (obj->callbacks.pre_patch)
+ ret = (*obj->callbacks.pre_patch)(obj);
obj->callbacks.post_unpatch_enabled = !ret;
@@ -39,6 +39,8 @@ static inline void klp_post_unpatch_callback(struct klp_object *obj)
if (obj->callbacks.post_unpatch_enabled &&
obj->callbacks.post_unpatch)
(*obj->callbacks.post_unpatch)(obj);
+
+ obj->callbacks.post_unpatch_enabled = false;
}
#endif /* _LIVEPATCH_CORE_H */