Commit 0ef7a26a authored by Dmitry Torokhov's avatar Dmitry Torokhov

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: default avatarDmitry Torokhov <dtor@mail.ru>
parent 59b01513
...@@ -855,10 +855,16 @@ static void atkbd_disconnect(struct serio *serio) ...@@ -855,10 +855,16 @@ static void atkbd_disconnect(struct serio *serio)
atkbd_disable(atkbd); 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); cancel_delayed_work_sync(&atkbd->event_work);
input_unregister_device(atkbd->dev);
serio_close(serio); serio_close(serio);
serio_set_drvdata(serio, NULL); serio_set_drvdata(serio, NULL);
kfree(atkbd); kfree(atkbd);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment