All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Console/stdio use after free
@ 2021-01-20 14:04 Nicolas Saenz Julienne
  2021-01-20 14:04 ` [PATCH 1/2] stdio: Introduce stdio_valid() Nicolas Saenz Julienne
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Nicolas Saenz Julienne @ 2021-01-20 14:04 UTC (permalink / raw)
  To: u-boot

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(+)

-- 
2.30.0

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2021-01-27 20:13 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-20 14:04 [PATCH 0/2] Console/stdio use after free Nicolas Saenz Julienne
2021-01-20 14:04 ` [PATCH 1/2] stdio: Introduce stdio_valid() Nicolas Saenz Julienne
2021-01-24  2:03   ` Simon Glass
2021-01-25 16:34     ` Nicolas Saenz Julienne
2021-01-27 20:13       ` Tom Rini
2021-01-20 14:04 ` [PATCH 2/2] console: Don't start/stop console if stdio device invalid Nicolas Saenz Julienne
2021-01-24  2:03   ` Simon Glass
2021-01-20 14:18 ` [PATCH 0/2] Console/stdio use after free Simon Glass
2021-01-20 14:44   ` Nicolas Saenz Julienne
2021-01-20 14:59     ` Simon Glass
2021-01-20 18:59   ` Pratyush Yadav
2021-01-20 19:54     ` Simon Glass
2021-01-20 15:57 ` Andy Shevchenko
2021-01-25 16:31   ` Nicolas Saenz Julienne

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.