You probably forgot to replace the subject with Josh's proposal. > module_put() is currently never called in klp_complete_transition() when > klp_force is set. As a result, we might keep the reference count even when > klp_enable_patch() fails and klp_cancel_transition() is called. Correct. > This might make an assumption that a module might get blocked in some > strange init state. Fortunately, it is not the case. The reference count > is ignored when mod->init fails and erroneous modules are always removed. I do not understand the paragraph and its connection to the problem (and I don't remember if I understood it previously or not and forgot to mention it). > Anyway, this might make some confusion. Instead, this patch moves > the global klp_forced flag into struct klp_patch. As a result, > we block only modules that might still be in use after a forced > transition. Newly loaded livepatches might be eventually completely > removed later. It makes sense by itself only. > It is not a big deal. But the code is at least consistent with > the reality. > > Signed-off-by: Petr Mladek <pmladek@xxxxxxxx> > @@ -633,5 +632,7 @@ void klp_force_transition(void) > for_each_possible_cpu(cpu) > klp_update_patch_state(idle_task(cpu)); > > - klp_forced = true; > + /* Refuse unloading all livepatches. The code might be in use. */ > + list_for_each_entry(patch, &klp_patches, list) > + patch->forced = true; Is the comment necessary? If yes, I'd change it to something similar to the new subject. Thanks, Miroslav