Re: [RFC][PATCH] module: Propagate MODULE_STATE_COMING notifier errors

From: Peter Zijlstra
Date: Wed Jun 19 2019 - 07:29:30 EST


On Wed, Jun 19, 2019 at 01:12:12PM +0200, Miroslav Benes wrote:
> > @@ -3780,7 +3781,7 @@ static int load_module(struct load_info *info, const char __user *uargs,
> >
> > err = prepare_coming_module(mod);
> > if (err)
> > - goto bug_cleanup;
> > + goto coming_cleanup;
>
> Not good. klp_module_going() is not prepared to be called without
> klp_module_coming() succeeding. "Funny" things might happen.

Bah, I did look at that but failed to spot it :/

> So it calls for more fine-grained error handling.

Another approach that I considered was trying to re-iterate the notifier
list up until the point we got, but that was fairly non-trivial and
needed changes to the notifier crud itself.

I'll try again.