]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
i2c: riic: fix refcount leak in riic_i2c_resume_noirq()
authorWentao Liang <vulab@iscas.ac.cn>
Mon, 8 Jun 2026 07:11:23 +0000 (07:11 +0000)
committerAndi Shyti <andi.shyti@kernel.org>
Mon, 8 Jun 2026 15:35:03 +0000 (17:35 +0200)
When riic_i2c_resume_noirq() is called, it deasserts the reset
using reset_control_deassert(), which for shared resets increments
a reference count. If pm_runtime_force_resume() then fails, the
function returns without calling reset_control_assert() to
decrement the count. This leaves the reset deasserted and the
reference count unbalanced, which can prevent other users of the
shared reset from properly asserting it later.

Fix the leak by calling reset_control_assert() on the error
handling path for a failed pm_runtime_force_resume().

Fixes: e383f0961422 ("i2c: riic: Move suspend handling to NOIRQ phase")
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Cc: <stable@vger.kernel.org> # v6.19+
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20260608071123.128964-1-vulab@iscas.ac.cn
drivers/i2c/busses/i2c-riic.c

index 9e3595b3623e4aca9bf6276ced073d5a0d513993..6d2ebf67dd62c37bdf7627bef4a10cfafb7422f8 100644 (file)
@@ -725,8 +725,10 @@ static int riic_i2c_resume_noirq(struct device *dev)
                return ret;
 
        ret = pm_runtime_force_resume(dev);
-       if (ret)
+       if (ret) {
+               reset_control_assert(riic->rstc);
                return ret;
+       }
 
        ret = riic_init_hw(riic);
        if (ret) {