Re: [PATCH v13 04/12] livepatch: Consolidate klp_free functions

From: Petr Mladek
Date: Thu Oct 18 2018 - 07:40:59 EST


On Wed 2018-10-17 13:22:54, Josh Poimboeuf wrote:
> On Mon, Oct 15, 2018 at 02:37:05PM +0200, Petr Mladek wrote:
> > @@ -637,6 +647,7 @@ static int klp_init_patch(struct klp_patch *patch)
> > mutex_lock(&klp_mutex);
> >
> > patch->enabled = false;
> > + INIT_LIST_HEAD(&patch->list);
>
> Is this a bug fix? If so, it should go in a separate patch. I'm
> wondering how this worked before.

It is not a bug fix. It was not needed before because
klp_register_patch() did not checked this field when failed.

But this patch started to use the generic
klp_free_patch_start()/klp_free_patch_finish() in both
klp_unregister_patch() and in klp_init_patch() error patch.
Therefore we need to have a valid value from the beginning.

Best Regards,
Petr