Skip to content

Console/stdio use after free

Andy Shevchenko u-boot 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest2 patches 0 repliesNew

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
2/2console: Don't start/stop console if stdio device invalid+0 -03 replies
2/2console: Don't start/stop console if stdio device invalid+0 -02 replies
2/2console: Don't start/stop console if stdio device invalid+0 -01 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/2] Console/stdio use after free
Quoted 6 lines · Nicolas Saenz Julienne

With today's master, 70c2525c0d3c ('IOMUX: Stop dropped consoles') introduces a use after free in usb_kbd_remove():

- usbkbd's stdio device is de-registered with stdio_deregister_dev(), the struct stdio_dev is freed.

Quoted 7 lines

- iomux_doenv() is called, usbkbd removed from the console list, and console_stop() is called on the struct stdio_dev pointer that no longer exists.

This series mitigates this by making sure the pointer is really a stdio device prior performing the stop operation. It's not ideal, but I couldn't figure out a nicer way to fix this.

I have just sent another approach, can you test it instead, please?

Signature · 2 lines
With Best Regards,
Andy Shevchenko