[PATCH v2] drivers: serial: Make sure we really return a serial device
Tom Rini
trini at konsulko.com
Wed Mar 9 21:00:52 CET 2022
On Mon, Feb 21, 2022 at 10:17:37PM +0100, Mark Kettenis wrote:
> The stdout-path property in the device tree does not necessarily
> point at a serial device. On machines such as the Apple M1 laptops
> where the serial port isn't easy to access and users expect to see
> console output on the integrated display stdout-path may point at
> the device tree node for the framebuffer for example.
>
> If stdout-path does not point at a node for a serial device, the
> serial_check_stdout() will not find a bound device and will drop
> down into code that attempts to use lists_bind_fdt() to bind a
> device anyway. However, that fallback code does not check that
> the uclass of the device is UCLASS_SERIAL. So if stdout-path points
> at the framebuffer instead of the serial device it will return a
> UCLASS_VIDEO device. Since the code that calls this function
> expects the returned device to be a UCLASS_SERIAL device, U-Boot
> will crash as soon as it attempts to send output to the console.
>
> Add a check here to verify that the uclass of the bound device
> really is UCLASS_SERIAL. If it isn't, serial_check_stdout() will
> return an error and serial_find_console_or_panic() will use the
> serial device with sequence number 0 as the console and all is fine.
>
> Signed-off-by: Mark Kettenis <kettenis at openbsd.org>
> Reviewed-by: Simon Glass <sjg at chromium.org>
Applied to u-boot/master, thanks!
--
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/20220309/4946e66e/attachment.sig>
More information about the U-Boot
mailing list