diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2010-01-05 17:56:02 -0800 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2010-01-06 00:16:14 -0800 |
commit | 0ef7a26af1278f7ec0b718148e88f01ba1953835 (patch) | |
tree | d62caa3387e9ed30051e764feacc96a15172e626 /drivers/input/keyboard/atkbd.c | |
parent | 59b015133cd0034f5904a76969d73476380aac46 (diff) | |
download | blackbird-op-linux-0ef7a26af1278f7ec0b718148e88f01ba1953835.tar.gz blackbird-op-linux-0ef7a26af1278f7ec0b718148e88f01ba1953835.zip |
Input: atkbd - fix canceling event_work in disconnect
We need to first unregister input device and only then cancel event work
since events can arrive (and cause event work to get scheduled again)
until input_unregister_device() returns.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/keyboard/atkbd.c')
-rw-r--r-- | drivers/input/keyboard/atkbd.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c index 1cf32a7814d0..7b4056292eaf 100644 --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c @@ -855,10 +855,16 @@ static void atkbd_disconnect(struct serio *serio) atkbd_disable(atkbd); - /* make sure we don't have a command in flight */ + input_unregister_device(atkbd->dev); + + /* + * Make sure we don't have a command in flight. + * Note that since atkbd->enabled is false event work will keep + * rescheduling itself until it gets canceled and will not try + * accessing freed input device or serio port. + */ cancel_delayed_work_sync(&atkbd->event_work); - input_unregister_device(atkbd->dev); serio_close(serio); serio_set_drvdata(serio, NULL); kfree(atkbd); |