Live Patching
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: Miroslav Benes <mbenes@suse.cz>
Cc: Yafang Shao <laoar.shao@gmail.com>,
	jpoimboe@kernel.org, jikos@kernel.org, joe.lawrence@redhat.com,
	song@kernel.org, live-patching@vger.kernel.org,
	sashiko-bot <sashiko-bot@kernel.org>
Subject: Re: [PATCH v3 1/7] livepatch: Fix NULL pointer dereference in klp_find_func()
Date: Wed, 24 Jun 2026 14:03:33 +0200	[thread overview]
Message-ID: <ajvHlaZN7UUgE0Rm@pathway.suse.cz> (raw)
In-Reply-To: <alpine.LSU.2.21.2606231015110.1711@pobox.suse.cz>

On Tue 2026-06-23 10:20:38, Miroslav Benes wrote:
> > > Anyway, could you send the fix separately since it is an existing issue,
> > > please?
> > 
> > Does the following change look good to you ?
> > 
> > diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
> > index 28d15ba58a26..317a3c866c76 100644
> > --- a/kernel/livepatch/core.c
> > +++ b/kernel/livepatch/core.c
> > @@ -799,9 +799,6 @@ void klp_free_replaced_patches_async(struct
> > klp_patch *new_patch)
> > 
> >  static int klp_init_func(struct klp_object *obj, struct klp_func *func)
> >  {
> > -       if (!func->old_name)
> > -               return -EINVAL;
> > -
> >         /*
> >          * NOPs get the address later. The patched module must be loaded,
> >          * see klp_init_object_loaded().
> > @@ -1107,8 +1104,9 @@ static int __klp_enable_patch(struct klp_patch *patch)
> >   */
> >  int klp_enable_patch(struct klp_patch *patch)
> >  {
> > -       int ret;
> >         struct klp_object *obj;
> > +       struct klp_func *func;
> > +       int ret;
> > 
> >         if (!patch || !patch->mod || !patch->objs)
> >                 return -EINVAL;
> > @@ -1116,9 +1114,12 @@ int klp_enable_patch(struct klp_patch *patch)
> >         klp_for_each_object_static(patch, obj) {
> >                 if (!obj->funcs)
> >                         return -EINVAL;
> > +               klp_for_each_func_static(obj, func) {
> > +                       if (!func->old_name)
> > +                               return -EINVAL;
> > +               }
> >         }
> > 
> > -
> >         if (!is_livepatch_module(patch->mod)) {
> >                 pr_err("module %s is not marked as a livepatch module\n",
> >                        patch->mod->name);
> 
> If you wrap it into klp_check_patch() which Petr proposed alongside 
> with all the checks at the beginning of klp_enable_patch() up to 
> is_livepatch_module(), then yes, I think.

+1

Best Regards,
Petr

  reply	other threads:[~2026-06-24 12:03 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-07 13:16 [PATCH v3 0/7] livepatch: Introduce replace set support Yafang Shao
2026-06-07 13:16 ` [PATCH v3 1/7] livepatch: Fix NULL pointer dereference in klp_find_func() Yafang Shao
2026-06-09 13:27   ` Petr Mladek
2026-06-10  3:00     ` Yafang Shao
2026-06-22 14:21     ` Miroslav Benes
2026-06-23  6:50       ` Yafang Shao
2026-06-23  8:20         ` Miroslav Benes
2026-06-24 12:03           ` Petr Mladek [this message]
2026-06-07 13:16 ` [PATCH v3 2/7] livepatch: Move klp_find_func() into core.h Yafang Shao
2026-06-09 15:28   ` Petr Mladek
2026-06-10  3:01     ` Yafang Shao
2026-06-07 13:16 ` [PATCH v3 3/7] livepatch: Support scoped atomic replace using replace_set Yafang Shao
2026-06-07 13:33   ` sashiko-bot
2026-06-07 14:00     ` Yafang Shao
2026-06-09 16:00   ` Petr Mladek
2026-06-10  3:24     ` Yafang Shao
2026-06-10  9:48       ` Petr Mladek
2026-06-11 12:58     ` Petr Mladek
2026-06-15 12:30       ` Yafang Shao
2026-06-16  2:41         ` Yafang Shao
2026-06-16 20:15       ` Joe Lawrence
2026-06-17  2:40         ` Yafang Shao
2026-06-17 14:54           ` Joe Lawrence
2026-06-18  9:20             ` Yafang Shao
2026-06-17 13:52         ` Petr Mladek
2026-06-17 20:06           ` Joe Lawrence
2026-06-18  2:34             ` Yafang Shao
2026-06-18 13:03             ` Petr Mladek
2026-06-22 17:26               ` Joe Lawrence
2026-06-23  3:08                 ` Yafang Shao
2026-06-23 15:38                   ` Joe Lawrence
2026-06-10 14:45   ` code review: was: " Petr Mladek
2026-06-11  3:06     ` Yafang Shao
2026-06-16 18:20   ` Joe Lawrence
2026-06-23  9:40   ` Miroslav Benes
2026-06-24 13:56     ` Petr Mladek
2026-06-24 14:05       ` Yafang Shao
2026-06-07 13:16 ` [PATCH v3 4/7] livepatch: Deprecate stack_order Yafang Shao
2026-06-07 13:31   ` sashiko-bot
2026-06-10 15:11   ` Petr Mladek
2026-06-11  3:21     ` Yafang Shao
2026-06-16 18:44       ` Joe Lawrence
2026-06-07 13:16 ` [PATCH v3 5/7] selftests/livepatch: Update tests for replace_set Yafang Shao
2026-06-07 13:29   ` sashiko-bot
2026-06-07 13:16 ` [PATCH v3 6/7] selftests/livepatch: Add test for state ID conflict across replace_sets Yafang Shao
2026-06-12  8:55   ` Petr Mladek
2026-06-15 11:59     ` Yafang Shao
2026-06-07 13:16 ` [PATCH v3 7/7] selftests/livepatch: Add test for function " Yafang Shao
2026-06-16 20:25 ` [PATCH v3 0/7] livepatch: Introduce replace set support Joe Lawrence
2026-06-17  2:21   ` Yafang Shao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ajvHlaZN7UUgE0Rm@pathway.suse.cz \
    --to=pmladek@suse.com \
    --cc=jikos@kernel.org \
    --cc=joe.lawrence@redhat.com \
    --cc=jpoimboe@kernel.org \
    --cc=laoar.shao@gmail.com \
    --cc=live-patching@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=sashiko-bot@kernel.org \
    --cc=song@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox