[PATCH v1] usb: kbd: destroy device after console is stopped

Tom Rini trini at konsulko.com
Thu Jan 28 18:58:30 CET 2021


On Thu, Jan 28, 2021 at 07:52:36PM +0200, Andy Shevchenko wrote:
> On Thu, Jan 28, 2021 at 07:46:49PM +0200, Andy Shevchenko wrote:
> > On Thu, Jan 28, 2021 at 06:19:56PM +0100, Nicolas Saenz Julienne wrote:
> > > Hi Andy,
> > > 
> > > On Thu, 2021-01-28 at 18:55 +0200, Andy Shevchenko wrote:
> > > > 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 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 at suse.de>
> > > > Signed-off-by: Andy Shevchenko <andriy.shevchenko at linux.intel.com>
> > > > ---
> > > > v2: Nicolas, can you test this one instead of yours?
> > > 
> > > Sadly this doesn't seem to work, and breaks a bunch of other tests in the
> > > process. You can try it yourself by running: './test/py/test.py --bd sandbox
> > > --build'
> > 
> > Thanks for trying.
> > 
> > Unfortunately I have unrelated bug somewhere:
> > Traceback (most recent call last):
> >   File "/home/andy/prj/u-boot/./test/py/test.py", line 20, in <module>
> >     sys.exit(load_entry_point('pytest', 'console_scripts', 'pytest')(args))
> > TypeError: console_main() takes 0 positional arguments but 1 was given
> 
> Seems test cases are broken in U-Boot.
> I'm not sure how you were able to run them.

This is I guess what Heinrich was posting a patch for earlier today.
The supported way to run the tests (so that they're the same for
everyone) is to use "pip" and "pip install -r test/py/requirements.txt".

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210128/a72b26a6/attachment.sig>


More information about the U-Boot mailing list