* [PATCH] input: psmouse: fix potential input register race in psmouse_connect()
@ 2008-01-12 20:13 Andres Salomon
2008-01-15 21:48 ` Dmitry Torokhov
0 siblings, 1 reply; 2+ messages in thread
From: Andres Salomon @ 2008-01-12 20:13 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: dtor, linux-kernel, linux-input, Andrew Morton
If we successfully call input_register_device() in
psmouse_connect but sysfs_create_group() fails, we'll enter the error
path without ever having called input_unregister_device() (potentially
leaking memory, or creating a race condition if something else attempts
to access the new input device). This calls input_unregister_device
from the error path, and sets input_dev to NULL so that we don't
attempt to also call input_free_device on it.
Signed-off-by: Andres Salomon <dilinger@debian.org>
---
drivers/input/mouse/psmouse-base.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index 21a9c0b..df25e7b 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -1247,6 +1247,8 @@ static int psmouse_connect(struct serio *serio, struct serio_driver *drv)
err_pt_deactivate:
if (parent && parent->pt_deactivate)
parent->pt_deactivate(parent);
+ input_unregister_device(psmouse->dev);
+ input_dev = NULL;
err_protocol_disconnect:
if (psmouse->disconnect)
psmouse->disconnect(psmouse);
--
1.5.3.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] input: psmouse: fix potential input register race in psmouse_connect()
2008-01-12 20:13 [PATCH] input: psmouse: fix potential input register race in psmouse_connect() Andres Salomon
@ 2008-01-15 21:48 ` Dmitry Torokhov
0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2008-01-15 21:48 UTC (permalink / raw)
To: Andres Salomon; +Cc: dtor, linux-kernel, linux-input, Andrew Morton
On Sat, Jan 12, 2008 at 03:13:45PM -0500, Andres Salomon wrote:
>
> If we successfully call input_register_device() in
> psmouse_connect but sysfs_create_group() fails, we'll enter the error
> path without ever having called input_unregister_device() (potentially
> leaking memory, or creating a race condition if something else attempts
> to access the new input device). This calls input_unregister_device
> from the error path, and sets input_dev to NULL so that we don't
> attempt to also call input_free_device on it.
>
> Signed-off-by: Andres Salomon <dilinger@debian.org>
Applied, thank you Andres.
--
Dmitry
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-01-15 21:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-12 20:13 [PATCH] input: psmouse: fix potential input register race in psmouse_connect() Andres Salomon
2008-01-15 21:48 ` Dmitry Torokhov
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 NNTP newsgroup(s).