Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: atkbd - cancel delayed work before freeing its structure

Pointed out by Oleg Nesterov. Since delayed work is used here, use of
flush_scheduled_work() is not sufficient in atkbd_disconnect(). It does
not wait for scheduled delayed work to finish. This patch prevents
delayed work to be processed after freeing atkbd structure (used struct
delayed_work is part of atkbd) by cancelling this delayed work.

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>

authored by

Jiri Pirko and committed by
Dmitry Torokhov
d6d79a78 a8215b81

+1 -1
+1 -1
drivers/input/keyboard/atkbd.c
··· 824 824 atkbd_disable(atkbd); 825 825 826 826 /* make sure we don't have a command in flight */ 827 - flush_scheduled_work(); 827 + cancel_delayed_work_sync(&atkbd->event_work); 828 828 829 829 sysfs_remove_group(&serio->dev.kobj, &atkbd_attribute_group); 830 830 input_unregister_device(atkbd->dev);