Skip to content

Console/stdio use after free

Nicolas Saenz Julienne u-boot 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2stdio: Introduce stdio_valid()common/stdio.c include/stdio_dev.h+12 -01 reply
1/2stdio: Introduce stdio_valid()+0 -01 reply
2/2console: Don't start/stop console if stdio device invalidcommon/console.c+3 -01 reply

Reviews trailers per patch

1 of 3 patches has a Reviewed-by or Acked-by.

PatchSimon Glass
1/2
1/2
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/2] Console/stdio use after free

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.

- 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.

Regards,
Nicolas

---

Nicolas Saenz Julienne (2):
stdio: Introduce stdio_valid()
console: Don't start/stop console if stdio device invalid

 common/console.c    |  3 +++
 common/stdio.c      | 11 +++++++++++
 include/stdio_dev.h |  1 +
 3 files changed, 15 insertions(+)
Signature · 1 line
2.30.0