Skip to content

Commit 383439d

Browse files
jpoimboePeter Zijlstra
authored andcommitted
livepatch: Skip task_call_func() for current task
The current task doesn't need the scheduler's protection to unwind its own stack. Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Petr Mladek <pmladek@suse.com> Tested-by: Seth Forshee (DigitalOcean) <sforshee@kernel.org> Link: https://lore.kernel.org/r/4b92e793462d532a05f03767151fa29db3e68e13.1677257135.git.jpoimboe@kernel.org
1 parent e92606f commit 383439d

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

kernel/livepatch/transition.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,11 @@ static bool klp_try_switch_task(struct task_struct *task)
312312
* functions. If all goes well, switch the task to the target patch
313313
* state.
314314
*/
315-
ret = task_call_func(task, klp_check_and_switch_task, &old_name);
315+
if (task == current)
316+
ret = klp_check_and_switch_task(current, &old_name);
317+
else
318+
ret = task_call_func(task, klp_check_and_switch_task, &old_name);
319+
316320
switch (ret) {
317321
case 0: /* success */
318322
break;

0 commit comments

Comments
 (0)