mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Minfei Huang <mhuang@redhat.com>
Cc: sjenning@redhat.com, jkosina@suse.cz, vojtech@suse.cz,
	live-patching@vger.kernel.org, linux-kernel@vger.kernel.org,
	Minfei Huang <mnfhuang@gmail.com>
Subject: Re: [PATCH] livepatch: klp_disable_func returnes once it does not satisfy the condition
Date: Mon, 13 Jul 2015 22:51:15 -0500	[thread overview]
Message-ID: <20150714035115.GC25198@treble.redhat.com> (raw)
In-Reply-To: <1436843737-17773-1-git-send-email-mhuang@redhat.com>

On Tue, Jul 14, 2015 at 11:15:37AM +0800, Minfei Huang wrote:
> From: Minfei Huang <mnfhuang@gmail.com>
> 
> It is more better that klp_disable_func returnes immediately, if
> func->state and func->old_addr do not satisfy the condition.
> 
> We should robust the livepatch code, although the above situation never
> happen in current code path.
> 
> Signed-off-by: Minfei Huang <mnfhuang@gmail.com>
> ---
>  kernel/livepatch/core.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
> index c40ebcc..6e53441 100644
> --- a/kernel/livepatch/core.c
> +++ b/kernel/livepatch/core.c
> @@ -348,8 +348,10 @@ static void klp_disable_func(struct klp_func *func)
>  {
>  	struct klp_ops *ops;
>  
> -	WARN_ON(func->state != KLP_ENABLED);
> -	WARN_ON(!func->old_addr);
> +	if (WARN_ON(func->state != KLP_ENABLED))
> +		return;
> +	if (WARN_ON(!func->old_addr))
> +		return;
>  
>  	ops = klp_find_ops(func->old_addr);
>  	if (WARN_ON(!ops))

Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>

  reply	other threads:[~2015-07-14  3:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-14  3:15 Minfei Huang
2015-07-14  3:51 ` Josh Poimboeuf [this message]
2015-07-14 20:49 ` Jiri Kosina

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=20150714035115.GC25198@treble.redhat.com \
    --to=jpoimboe@redhat.com \
    --cc=jkosina@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=mhuang@redhat.com \
    --cc=mnfhuang@gmail.com \
    --cc=sjenning@redhat.com \
    --cc=vojtech@suse.cz \
    /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

all inboxes | Powered by JetHome®