diff options
| author | 2026-10-11 20:17:58 +0800 | |
|---|---|---|
| committer | 2026-10-19 22:01:58 +0200 | |
| commit | 22b9306f1fcf86f80b55f05f08d10a9951ba970a (patch) | |
| tree | 18b01521f9edfb77ea36eb8dbb909a9396bd4cef /scripts/Makefile.thinlto | |
| parent | rtc: sun6i: add Allwinner B288 compatible (diff) | |
platform/x86/amd/pmc: Fix RTC reference leak in amd_pmc_verify_czn_rtc()
amd_pmc_verify_czn_rtc() opens the RTC with rtc_class_open(), which
takes both a device reference and a module reference on the RTC
driver. The matching release is rtc_class_close(), and it is never
called. Every return path after the device has been opened, the ones
that return 0 as well as the ones that report an error, leaves both
references behind, so each S0i3 suspend leaks them.
Release the reference with a __free() cleanup on the declaration,
which covers every return path without adding labels.
rtc_class_close() does not accept a NULL argument, so the cleanup
helper has to guard against one: rtc_class_open() may fail and the
declaration still has to be cleaned up.
Found by code review.
Fixes: 59348401ebed ("platform/x86: amd-pmc: Add special handling for timer based S0i3 wakeup")
Cc: stable@vger.kernel.org
Signed-off-by: Ma Ke <make_ruc2021@163.com>
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
Link: https://patch.msgid.link/20261011121759.3267678-1-make_ruc2021@163.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
