]> git.dujemihanovic.xyz Git - u-boot.git/commit
usb: kbd: destroy device after console is stopped
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 11 Feb 2021 15:09:44 +0000 (17:09 +0200)
committerTom Rini <trini@konsulko.com>
Tue, 16 Feb 2021 16:16:08 +0000 (11:16 -0500)
commiteb5fd9e46c11ea41430d9c5bcc81d4583424216e
tree9350503678e51ec6ae294772ba83e233085629e1
parent694cd5618c2ee263c025462e780354f28313b7a3
usb: kbd: destroy device after console is stopped

In case of IOMUX enabled it assumes that console devices in the list
are available to get them stopped properly via ->stop() callback.
However, the USB keyboard driver violates this assumption and tries
to play tricks so the device get destroyed while being listed as
an active console.

Swap the order of device deregistration and IOMUX update along with
converting to use iomux_replace_device() jelper to avoid the use-after-free.

Fixes: 3cbcb2892809 ("usb: Fix usb_kbd_deregister when console-muxing is used")
Fixes: 8a8348703081 ("dm: usb: Add a remove() method for USB keyboards")
Reported-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
common/usb_kbd.c