* [PATCH -next] livepatch: Fix missing unlock on error in klp_enable_patch()
@ 2021-12-25 2:51 Yang Yingliang
2021-12-27 16:31 ` David Vernet
2022-01-03 13:46 ` Petr Mladek
0 siblings, 2 replies; 5+ messages in thread
From: Yang Yingliang @ 2021-12-25 2:51 UTC (permalink / raw)
To: linux-kernel, live-patching; +Cc: jpoimboe, jikos, mbenes, pmladek, void
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH -next] livepatch: Fix missing unlock on error in klp_enable_patch()
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
2022-01-03 10:49 ` Petr Mladek
2022-01-03 13:46 ` Petr Mladek
1 sibling, 1 reply; 5+ messages in thread
From: David Vernet @ 2021-12-27 16:31 UTC (permalink / raw)
To: Yang Yingliang
Cc: linux-kernel, live-patching, jpoimboe, jikos, mbenes, pmladek
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>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH -next] livepatch: Fix missing unlock on error in klp_enable_patch()
2021-12-27 16:31 ` David Vernet
@ 2022-01-03 10:49 ` Petr Mladek
0 siblings, 0 replies; 5+ messages in thread
From: Petr Mladek @ 2022-01-03 10:49 UTC (permalink / raw)
To: David Vernet
Cc: Yang Yingliang, linux-kernel, live-patching, jpoimboe, jikos, mbenes
On Mon 2021-12-27 08:31:45, David Vernet wrote:
> 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.
And nobody caught it. I think that it was partly caused by
a pre-holiday loss of concentration :-/
> Acked-by: David Vernet <void@manifault.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Best Regards,
Petr
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH -next] livepatch: Fix missing unlock on error in klp_enable_patch()
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
@ 2022-01-03 13:46 ` Petr Mladek
2022-01-04 13:09 ` Petr Mladek
1 sibling, 1 reply; 5+ messages in thread
From: Petr Mladek @ 2022-01-03 13:46 UTC (permalink / raw)
To: Yang Yingliang; +Cc: linux-kernel, live-patching, jpoimboe, jikos, mbenes, void
On Sat 2021-12-25 10:51:15, Yang Yingliang wrote:
> 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>
JFYI, the patch has been committed into livepatch.git,
branch for-5.17/fixes.
Best Regards,
Petr
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH -next] livepatch: Fix missing unlock on error in klp_enable_patch()
2022-01-03 13:46 ` Petr Mladek
@ 2022-01-04 13:09 ` Petr Mladek
0 siblings, 0 replies; 5+ messages in thread
From: Petr Mladek @ 2022-01-04 13:09 UTC (permalink / raw)
To: Yang Yingliang; +Cc: linux-kernel, live-patching, jpoimboe, jikos, mbenes, void
On Mon 2022-01-03 14:46:42, Petr Mladek wrote:
> On Sat 2021-12-25 10:51:15, Yang Yingliang wrote:
> > 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>
>
> JFYI, the patch has been committed into livepatch.git,
> branch for-5.17/fixes.
Just for record. I had to rebase the branch for-5.17/fixes because of
missing Signed-off. I have updated Fixes: line to match the hash
of the rebased commit. I hope that this fixed all my pre-holidays
mistakes.
Best Regards,
Petr
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-01-04 13:09 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2022-01-03 10:49 ` Petr Mladek
2022-01-03 13:46 ` Petr Mladek
2022-01-04 13:09 ` Petr Mladek
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.