U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: Mark Kettenis <kettenis@openbsd.org>
Cc: u-boot@lists.denx.de, sjg@chromium.org
Subject: Re: [PATCH v2] drivers: serial: Make sure we really return a serial device
Date: Wed, 9 Mar 2022 15:00:52 -0500	[thread overview]
Message-ID: <20220309200052.GV5020@bill-the-cat> (raw)
In-Reply-To: <20220221211737.39653-1-kettenis@openbsd.org>

[-- Attachment #1: Type: text/plain, Size: 1443 bytes --]

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@openbsd.org>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

      parent reply	other threads:[~2022-03-09 20:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-21 21:17 [PATCH v2] drivers: serial: Make sure we really return a serial device Mark Kettenis
2022-03-06  3:07 ` Simon Glass
2022-03-09 20:00 ` Tom Rini [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220309200052.GV5020@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=kettenis@openbsd.org \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox