From: "Ahelenia Ziemiańska" <nabijaczleweli@nabijaczleweli.xyz>
To: Yoshinori Sato <ysato@users.sourceforge.jp>,
Rich Felker <dalias@libc.org>,
John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>,
Paul Mundt <lethal@linux-sh.org>,
Kristoffer Ericson <Kristoffer.Ericson@gmail.com>,
linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] sh: hp6xx: unset apm_get_power_status on unload
Date: Fri, 17 Oct 2025 00:05:16 +0200 [thread overview]
Message-ID: <ydtnrqqjuaz6uifqplujmqwdnpxoe7ma33d5hp4waavekerod2@tarta.nabijaczleweli.xyz> (raw)
[-- Attachment #1: Type: text/plain, Size: 1154 bytes --]
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@nabijaczleweli.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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
reply other threads:[~2025-10-16 22:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ydtnrqqjuaz6uifqplujmqwdnpxoe7ma33d5hp4waavekerod2@tarta.nabijaczleweli.xyz \
--to=nabijaczleweli@nabijaczleweli.xyz \
--cc=Kristoffer.Ericson@gmail.com \
--cc=dalias@libc.org \
--cc=glaubitz@physik.fu-berlin.de \
--cc=lethal@linux-sh.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=ysato@users.sourceforge.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).