Merge tag 'ptrace-cleanups-for-v5.18' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-microblaze.git] / kernel / livepatch / transition.c
index df808d9..5d03a2a 100644 (file)
@@ -640,6 +640,13 @@ void klp_force_transition(void)
        for_each_possible_cpu(cpu)
                klp_update_patch_state(idle_task(cpu));
 
-       klp_for_each_patch(patch)
-               patch->forced = true;
+       /* Set forced flag for patches being removed. */
+       if (klp_target_state == KLP_UNPATCHED)
+               klp_transition_patch->forced = true;
+       else if (klp_transition_patch->replace) {
+               klp_for_each_patch(patch) {
+                       if (patch != klp_transition_patch)
+                               patch->forced = true;
+               }
+       }
 }