* [PATCH] auxdisplay: panel: free logical inputs on detach
@ 2026-11-28 12:47 Muhammad Mahdi Amirpour
2026-12-03 10:01 ` Andy Shevchenko
0 siblings, 1 reply; 2+ messages in thread
From: Muhammad Mahdi Amirpour @ 2026-11-28 12:47 UTC (permalink / raw)
To: willy, ksenija.stanojevic, andy
Cc: geert, linux-kernel, Muhammad Mahdi Amirpour
Free all allocated logical inputs when the panel device is
detached or attachment fails.
Stop the scan timer before freeing the input list to prevent
the timer callback from accessing freed entries.
Reset the scan masks after releasing the inputs.
Signed-off-by: Muhammad Mahdi Amirpour <ampr.mhd@gmail.com>
---
drivers/auxdisplay/panel.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/drivers/auxdisplay/panel.c b/drivers/auxdisplay/panel.c
index 2a567a075e2b..f4d279816b53 100644
--- a/drivers/auxdisplay/panel.c
+++ b/drivers/auxdisplay/panel.c
@@ -1471,6 +1471,19 @@ static void keypad_init(void)
/* device initialization */
/**************************************************/
+static void panel_free_inputs(void)
+{
+ struct logical_input *input, *tmp;
+
+ list_for_each_entry_safe(input, tmp, &logical_inputs, list) {
+ list_del(&input->list);
+ kfree(input);
+ }
+
+ scan_mask_i = 0;
+ scan_mask_o = 0;
+}
+
static void panel_attach(struct parport *port)
{
int selected_keypad_type = NOT_SET;
@@ -1615,6 +1628,10 @@ static void panel_attach(struct parport *port)
err_lcd_unreg:
if (scan_timer.function)
timer_delete_sync(&scan_timer);
+
+ keypad_initialized = 0;
+ panel_free_inputs();
+
if (lcd.enabled)
charlcd_unregister(lcd.charlcd);
err_unreg_device:
@@ -1642,6 +1659,8 @@ static void panel_detach(struct parport *port)
keypad_initialized = 0;
}
+ panel_free_inputs();
+
if (lcd.enabled) {
charlcd_unregister(lcd.charlcd);
lcd.initialized = false;
@@ -1649,7 +1668,6 @@ static void panel_detach(struct parport *port)
lcd.charlcd = NULL;
}
- /* TODO: free all input signals */
parport_release(pprt);
parport_unregister_device(pprt);
pprt = NULL;
--
2.56.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] auxdisplay: panel: free logical inputs on detach
2026-11-28 12:47 [PATCH] auxdisplay: panel: free logical inputs on detach Muhammad Mahdi Amirpour
@ 2026-12-03 10:01 ` Andy Shevchenko
0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2026-12-03 10:01 UTC (permalink / raw)
To: Muhammad Mahdi Amirpour
Cc: willy, ksenija.stanojevic, andy, geert, linux-kernel
On Sat, Nov 28, 2026 at 04:17:41PM +0330, Muhammad Mahdi Amirpour wrote:
> Free all allocated logical inputs when the panel device is
> detached or attachment fails.
>
> Stop the scan timer before freeing the input list to prevent
> the timer callback from accessing freed entries.
>
> Reset the scan masks after releasing the inputs.
This is quite an old driver and interface it uses. How did you find the issue?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-03 10:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-28 12:47 [PATCH] auxdisplay: panel: free logical inputs on detach Muhammad Mahdi Amirpour
2026-12-03 10:01 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®