[PATCH] apm-power.c: Fix crash when unloading modules

Subsystems: input (keyboard, mouse, joystick, touchscreen) drivers, the rest

STALE6743d

2 messages, 2 authors, 2008-03-24 · open the first message on its own page

[PATCH] apm-power.c: Fix crash when unloading modules

From: Helge Deller <deller@gmx.de>
Date: 2008-03-24 13:43:21

This patch fixes a crash in the apm-power driver when a input-device
(e.g. a keyboard driver module) is unloaded.
Fix is the same as it's used in the evbug driver.
I assume this patch went unnoticed, since most keyboard drivers
in PDAs are not compiled as modules.

Signed-off-by: Helge Deller <deller@gmx.de>
CC: Richard Purdie <redacted>

--
 apm-power.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
--
diff --git a/drivers/input/apm-power.c b/drivers/input/apm-power.c
index c36d110..7d61a96 100644
--- a/drivers/input/apm-power.c
+++ b/drivers/input/apm-power.c
@@ -63,8 +63,6 @@ static int apmpower_connect(struct input_handler *handler,
 	handle->handler = handler;
 	handle->name = "apm-power";
 
-	handler->private = handle;
-
 	error = input_register_handle(handle);
 	if (error) {
 		printk(KERN_ERR
@@ -87,11 +85,10 @@ static int apmpower_connect(struct input_handler *handler,
 	return 0;
 }
 
-static void apmpower_disconnect(struct input_handle *handler)
+static void apmpower_disconnect(struct input_handle *handle)
 {
-	struct input_handle *handle = handler->private;
-
 	input_close_device(handle);
+	input_unregister_handle(handle);
 	kfree(handle);
 }
 

Re: [PATCH] apm-power.c: Fix crash when unloading modules

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2008-03-24 15:03:34

On Mon, Mar 24, 2008 at 02:43:18PM +0100, Helge Deller wrote:
This patch fixes a crash in the apm-power driver when a input-device
(e.g. a keyboard driver module) is unloaded.
Fix is the same as it's used in the evbug driver.
I assume this patch went unnoticed, since most keyboard drivers
in PDAs are not compiled as modules.

Signed-off-by: Helge Deller <deller@gmx.de>
CC: Richard Purdie <redacted>
Applied to the "for-linus" branch of my tree, thank you Helge.

-- 
Dmitry
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help