Merge tag 'for-linus-5.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml
[linux-2.6-microblaze.git] / kernel / livepatch / transition.c
index cdf318d..f6310f8 100644 (file)
@@ -78,7 +78,7 @@ static void klp_complete_transition(void)
                 klp_target_state == KLP_PATCHED ? "patching" : "unpatching");
 
        if (klp_transition_patch->replace && klp_target_state == KLP_PATCHED) {
-               klp_discard_replaced_patches(klp_transition_patch);
+               klp_unpatch_replaced_patches(klp_transition_patch);
                klp_discard_nops(klp_transition_patch);
        }
 
@@ -446,14 +446,14 @@ void klp_try_complete_transition(void)
        klp_complete_transition();
 
        /*
-        * It would make more sense to free the patch in
+        * It would make more sense to free the unused patches in
         * klp_complete_transition() but it is called also
         * from klp_cancel_transition().
         */
-       if (!patch->enabled) {
-               klp_free_patch_start(patch);
-               schedule_work(&patch->free_work);
-       }
+       if (!patch->enabled)
+               klp_free_patch_async(patch);
+       else if (patch->replace)
+               klp_free_replaced_patches_async(patch);
 }
 
 /*