[PATCH] rtc: meson: fix refcount leak in meson_rtc_get_bus
Philipp Zabel
p.zabel at pengutronix.de
Thu Jun 11 01:08:55 PDT 2026
On Thu, Jun 11, 2026 at 11:56:05AM +0800, WenTao Liang wrote:
> In meson_rtc_get_bus(), reset_control_reset() is called to trigger
> a hardware reset when the serial bus is not ready. The function may
> retry up to three times, but neither the successful nor the failure
> path calls reset_control_rearm() to balance the reference count,
> leaking the triggered_count on shared reset controls.
Wrong, this driver uses exclusive reset control, which does not do any
refcounting. Arguably, it should request the reset control via
devm_regulator_get_exclusive() instead of devm_regulator_get() to
make this clear.
> Fix this by adding reset_control_rearm() after reset_control_reset()
> on both the error return path and the success path within the retry
> loop, ensuring the reset control can be re-triggered on subsequent
> bus acquisition attempts.
This doesn't fix anything, reset_control_rearm() does nothing and
should not be used with exclusive reset controls.
regards
Philipp
More information about the linux-arm-kernel
mailing list