summaryrefslogtreecommitdiff
path: root/kernel/livepatch/core.h
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/livepatch/core.h')
-rw-r--r--kernel/livepatch/core.h8
1 files changed, 5 insertions, 3 deletions
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 */