Re: [PATCH 1/2] livepatch: Remove custom kobject state handling

From: Kamalesh Babulal
Date: Fri May 03 2019 - 12:35:45 EST


On Fri, May 03, 2019 at 03:26:24PM +0200, Petr Mladek wrote:
> kobject_init() always succeeds and sets the reference count to 1.
> It allows to always free the structures via kobject_put() and
> the related release callback.
>
> Note that the custom kobject state handling was used only
> because we did not know that kobject_put() can and actually
> should get called even when kobject_init_and_add() fails.
>
> The patch should not change the existing behavior.
>
> Suggested-by: "Tobin C. Harding" <tobin@xxxxxxxxxx>
> Signed-off-by: Petr Mladek <pmladek@xxxxxxxx>
> ---
> include/linux/livepatch.h | 3 ---
> kernel/livepatch/core.c | 56 ++++++++++++++---------------------------------
> 2 files changed, 17 insertions(+), 42 deletions(-)
>
> diff --git a/include/linux/livepatch.h b/include/linux/livepatch.h
> index 53551f470722..a14bab1a0a3e 100644
> --- a/include/linux/livepatch.h
> +++ b/include/linux/livepatch.h
> @@ -86,7 +86,6 @@ struct klp_func {
> struct list_head node;
> struct list_head stack_node;
> unsigned long old_size, new_size;
> - bool kobj_added;
> bool nop;
> bool patched;
> bool transition;

Minor nitpick, the description of kobj_added needs to be removed from
structure descriptions.

Reviewed-by: Kamalesh Babulal <kamalesh@xxxxxxxxxxxxxxxxxx>

--
Kamalesh