Re: [PATCH] ftrace: Free the trampoline when ftrace_startup() fails

From: Steven Rostedt
Date: Fri Sep 18 2020 - 12:20:12 EST


On Mon, 31 Aug 2020 14:56:57 +0200 (CEST)
Miroslav Benes <mbenes@xxxxxxx> wrote:

> I used Masami's address which did not work. Sorry about that. Should be ok
> now.

Thanks Miroslav,

I've queued this up to be tested and pushed as urgent.

-- Steve

>
> On Mon, 31 Aug 2020, Miroslav Benes wrote:
>
> > Commit fc0ea795f53c ("ftrace: Add symbols for ftrace trampolines")
> > missed to remove ops from new ftrace_ops_trampoline_list in
> > ftrace_startup() if ftrace_hash_ipmodify_enable() fails there. It may
> > lead to BUG if such ops come from a module which may be removed.
> >
> > Moreover, the trampoline itself is not freed in this case.
> >
> > Fix it by calling ftrace_trampoline_free() during the rollback.
> >
> > Fixes: fc0ea795f53c ("ftrace: Add symbols for ftrace trampolines")
> > Signed-off-by: Miroslav Benes <mbenes@xxxxxxx>
> > ---
> >