[<prev] [next>] [day] [month] [year] [list]
Message-ID: <ydtnrqqjuaz6uifqplujmqwdnpxoe7ma33d5hp4waavekerod2@tarta.nabijaczleweli.xyz>
Date: Fri, 17 Oct 2025 00:05:16 +0200
From:
Ahelenia Ziemiańska <nabijaczleweli@...ijaczleweli.xyz>
To: Yoshinori Sato <ysato@...rs.sourceforge.jp>,
Rich Felker <dalias@...c.org>, John Paul Adrian Glaubitz <glaubitz@...sik.fu-berlin.de>,
Paul Mundt <lethal@...ux-sh.org>, Kristoffer Ericson <Kristoffer.Ericson@...il.com>,
linux-sh@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] sh: hp6xx: unset apm_get_power_status on unload
The API for apm_get_power_status is "call it if it isn't NULL".
If the module is unloaded and it's not unset,
reading /proc/apm will jump into unloaded kernel memory.
The first commit that added this incompletely refactored
the assigned-to variable in __exit,
the second deleted it instead of fixing it.
Unset it on unload like drivers/macintosh/apm_emu.c.
Fixes: 0a9b0db19262 ("[APM] SH: Convert to use shared APM emulation.")
Fixes: 8c8ee8254767 ("sh: hp6xx: APM build fix and new battery values.")
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@...ijaczleweli.xyz>
---
arch/sh/boards/mach-hp6xx/hp6xx_apm.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/sh/boards/mach-hp6xx/hp6xx_apm.c b/arch/sh/boards/mach-hp6xx/hp6xx_apm.c
index e5c4c7d34139..089eca39c4e6 100644
--- a/arch/sh/boards/mach-hp6xx/hp6xx_apm.c
+++ b/arch/sh/boards/mach-hp6xx/hp6xx_apm.c
@@ -98,6 +98,9 @@ static int __init hp6x0_apm_init(void)
static void __exit hp6x0_apm_exit(void)
{
+ if (apm_get_power_status == hp6x0_apm_get_power_status)
+ apm_get_power_status = NULL;
+
free_irq(HP680_BTN_IRQ, 0);
}
--
2.39.5
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists