Re: [PATCH] reset: fix refcount leak in reset_control_bulk_assert()
From: Philipp Zabel
Date: Thu Jun 11 2026 - 04:14:16 EST
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@xxxxxxxxxxx>
> ---
> 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