* [PATCH] reset: fix refcount leak in reset_control_bulk_assert()
@ 2026-06-11 1:57 WenTao Liang
2026-06-11 8:13 ` Philipp Zabel
0 siblings, 1 reply; 2+ messages in thread
From: WenTao Liang @ 2026-06-11 1:57 UTC (permalink / raw)
To: Philipp Zabel; +Cc: Hans de Goede, linux-kernel, WenTao Liang
When reset_control_bulk_assert() asserts a batch of reset controls,
it calls reset
Fixes: 0b52297f2288 ("reset: Add support for shared reset controls")
Signed-off-by: WenTao Liang <vulab@iscas.ac.cn>
---
drivers/reset/core.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/reset/core.c b/drivers/reset/core.c
index 38e189d04d09..daf9201bc105 100644
--- a/drivers/reset/core.c
+++ b/drivers/reset/core.c
@@ -516,8 +516,15 @@ int reset_control_assert(struct reset_control *rstc)
if (WARN_ON(atomic_read(&rstc->deassert_count) == 0))
return -EINVAL;
- if (atomic_dec_return(&rstc->deassert_count) != 0)
+ if (atomic_dec_return(&rstc->deassert_count) != 0) {
+ int err = rcdev->ops->assert(rcdev, rstc->id);
+
+ if (err) {
+ atomic_inc(&rstc->deassert_count);
+ return err;
+ }
return 0;
+ }
/*
* Shared reset controls allow the reset line to be in any state
--
2.50.1 (Apple Git-155)
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] reset: fix refcount leak in reset_control_bulk_assert()
2026-06-11 1:57 [PATCH] reset: fix refcount leak in reset_control_bulk_assert() WenTao Liang
@ 2026-06-11 8:13 ` Philipp Zabel
0 siblings, 0 replies; 2+ messages in thread
From: Philipp Zabel @ 2026-06-11 8:13 UTC (permalink / raw)
To: WenTao Liang; +Cc: Hans de Goede, linux-kernel
On Thu, Jun 11, 2026 at 09:57:31AM +0800, WenTao Liang wrote:
> When reset_control_bulk_assert() asserts a batch of reset controls,
> it calls reset
Can you write a better commit message?
What does this patch accomplish, and why?
> Fixes: 0b52297f2288 ("reset: Add support for shared reset controls")
> Signed-off-by: WenTao Liang <vulab@iscas.ac.cn>
> ---
> drivers/reset/core.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/reset/core.c b/drivers/reset/core.c
> index 38e189d04d09..daf9201bc105 100644
> --- a/drivers/reset/core.c
> +++ b/drivers/reset/core.c
> @@ -516,8 +516,15 @@ int reset_control_assert(struct reset_control *rstc)
> if (WARN_ON(atomic_read(&rstc->deassert_count) == 0))
> return -EINVAL;
>
> - if (atomic_dec_return(&rstc->deassert_count) != 0)
> + if (atomic_dec_return(&rstc->deassert_count) != 0) {
> + int err = rcdev->ops->assert(rcdev, rstc->id);
This is wrong, asserting the reset must not happen unless deassert_count
has been decremented to zero.
regards
Philipp
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-06-11 8:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-11 1:57 [PATCH] reset: fix refcount leak in reset_control_bulk_assert() WenTao Liang
2026-06-11 8:13 ` Philipp Zabel
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.