All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Vernet <void@manifault.com>
To: Yang Yingliang <yangyingliang@huawei.com>
Cc: linux-kernel@vger.kernel.org, live-patching@vger.kernel.org,
	jpoimboe@redhat.com, jikos@kernel.org, mbenes@suse.cz,
	pmladek@suse.com
Subject: Re: [PATCH -next] livepatch: Fix missing unlock on error in klp_enable_patch()
Date: Mon, 27 Dec 2021 08:31:45 -0800	[thread overview]
Message-ID: <YcnqcXMQ7hxBe68a@dev0025.ash9.facebook.com> (raw)
In-Reply-To: <20211225025115.475348-1-yangyingliang@huawei.com>

Yang Yingliang <yangyingliang@huawei.com> wrote on Sat [2021-Dec-25 10:51:15 +0800]:
> Add missing unlock when try_module_get() fails in klp_enable_patch().
> 
> Fixes: bf01c2975925 ("livepatch: Fix kobject refcount bug on klp_init_patch_early failure path")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>  kernel/livepatch/core.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
> index 23cf444091a8..01bfab7fe7c0 100644
> --- a/kernel/livepatch/core.c
> +++ b/kernel/livepatch/core.c
> @@ -1047,8 +1047,10 @@ int klp_enable_patch(struct klp_patch *patch)
>  		return -EINVAL;
>  	}
>  
> -	if (!try_module_get(patch->mod))
> +	if (!try_module_get(patch->mod)) {
> +		mutex_unlock(&klp_mutex);
>  		return -ENODEV;
> +	}
>  
>  	klp_init_patch_early(patch);
>  
> -- 
> 2.25.1
> 

Apologies for the silly oversight. Thank you for the fix.

Acked-by: David Vernet <void@manifault.com>

  reply	other threads:[~2021-12-27 16:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-25  2:51 [PATCH -next] livepatch: Fix missing unlock on error in klp_enable_patch() Yang Yingliang
2021-12-27 16:31 ` David Vernet [this message]
2022-01-03 10:49   ` Petr Mladek
2022-01-03 13:46 ` Petr Mladek
2022-01-04 13:09   ` Petr Mladek

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=YcnqcXMQ7hxBe68a@dev0025.ash9.facebook.com \
    --to=void@manifault.com \
    --cc=jikos@kernel.org \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=pmladek@suse.com \
    --cc=yangyingliang@huawei.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.