From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BD8CFC433F5 for ; Wed, 9 Mar 2022 20:01:03 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BCCA88398B; Wed, 9 Mar 2022 21:01:00 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="K1vC8cur"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6193E8399C; Wed, 9 Mar 2022 21:00:59 +0100 (CET) Received: from mail-qv1-xf34.google.com (mail-qv1-xf34.google.com [IPv6:2607:f8b0:4864:20::f34]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 30B648397F for ; Wed, 9 Mar 2022 21:00:56 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qv1-xf34.google.com with SMTP id gm1so2881384qvb.7 for ; Wed, 09 Mar 2022 12:00:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=bL3P1t/E4Z8R/wVcsHX2DunMLO2qHSgnSFGpB7exflk=; b=K1vC8curZKOI05VAfmnJCRYIlRTA36Awr56Vg9b0vr5hyBWeKh7dRc385HfHB3gJme /qmC9jnYpS0dos08VxNop6o/jdygl6+nillEqWJrizI38cMhB61Y6Vd4BL7jQnH8mryQ DLUJGuuLgIMzGMyntQ2JtA4ooeCXAYdNdyS2s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=bL3P1t/E4Z8R/wVcsHX2DunMLO2qHSgnSFGpB7exflk=; b=X0xq4oO+91N0avUVNhhEDGO+wZT1Gr4CrtbzrSutlEwbFAeiaKqmWkeVxkeaiRMxs3 cR55nifbTQy6jClhBMhg0jnqnjJhEQxDUQQSInfDAzpvp9Z/mXZCpN3fm5SrQ4p05wbj CtheBeW/faUqtd0plcYQh/yg4VD+816eqz+eta/cJhuSfJqCkIpZhCUbqa7xCgTMNBYc 8URNpEzhwcOnjPuyhyoLOYYiq/+IpELC+eVU/j+SOcb9Knfy9iutPjQ+FxFB3lbyy+3p vFQvdGTVwFDqwHmFNGFCvz2YfoZtOrKuq9KijhRyYiPSCaOqKE0xTOPv4fy2iiQogWz3 IfqA== X-Gm-Message-State: AOAM533jwHvlSWlTERY4xfg7/wrWi0Fl9JzOwviQXqSqcYVbQ0rAKFma ixrZVyCU60JG+niD88ENz3B/qw== X-Google-Smtp-Source: ABdhPJyk5C6RXR0rDtgC77RYE2Wo32DbmiqCE1HtJT40Lo3GnzNqhlOPNG5y/P994/yV0lWDZ+wHHQ== X-Received: by 2002:ad4:5de2:0:b0:435:6997:5408 with SMTP id jn2-20020ad45de2000000b0043569975408mr1036278qvb.121.1646856054629; Wed, 09 Mar 2022 12:00:54 -0800 (PST) Received: from bill-the-cat (2603-6081-7b01-cbda-2ef0-5dff-fedb-a8ba.res6.spectrum.com. [2603:6081:7b01:cbda:2ef0:5dff:fedb:a8ba]) by smtp.gmail.com with ESMTPSA id k10-20020ac85fca000000b002dce6b890casm1856366qta.40.2022.03.09.12.00.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Mar 2022 12:00:53 -0800 (PST) Date: Wed, 9 Mar 2022 15:00:52 -0500 From: Tom Rini To: Mark Kettenis Cc: u-boot@lists.denx.de, sjg@chromium.org Subject: Re: [PATCH v2] drivers: serial: Make sure we really return a serial device Message-ID: <20220309200052.GV5020@bill-the-cat> References: <20220221211737.39653-1-kettenis@openbsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="tYqdTR6Mwu/xEI6p" Content-Disposition: inline In-Reply-To: <20220221211737.39653-1-kettenis@openbsd.org> X-Clacks-Overhead: GNU Terry Pratchett X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean --tYqdTR6Mwu/xEI6p Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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. >=20 > 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. >=20 > 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. >=20 > Signed-off-by: Mark Kettenis > Reviewed-by: Simon Glass Applied to u-boot/master, thanks! --=20 Tom --tYqdTR6Mwu/xEI6p Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmIpB2oACgkQFHw5/5Y0 tyzQMQv+MMNuwfVgvy0YEisYRdKDgnTtQ3AR2g8Uy54VQOia7DOMRR3SYVTW+yNi yg4BFELL+nYpXzgiJK5KPhMrJDlz3NlLx/wkzN/oiNPwnBXHDa2YeP2vHgvP2fXg XGXr0u9i4LGpuemlHnM5nQIGLwhOrml876DLz2tvtzWj7UMPd/CJxeoWTLb2F+g2 6gE0K6DpJyfa7tQ6cLeQFLXc1XMNXO2NxPiKmkNYdrKP2Vhjso1MM0UhRErFIz/I Hax0dAIST7VfySSZQ5HEWvdOPbWMrxJNwmbqnRByQEQ/Z1PQHK7HkpqkdaxHbcx2 worjjBqU5dErMUD2sYNT/v0ES125yKJwiTcBtRnAEWvzIu2srerjKzaxqHI8BRzj bE2x8b6eiH7DBulMeP5W4okeAdlS12DNheOsTKB9nINLEFef3173ZaRZbuVwmLkm uTGmFmwt0IaHLrRoF/LezGG+mc572TSsUWt7HJ+YJYgLYShZ4kYXkik3Pe+rIfps hHaiL4NW =vFRm -----END PGP SIGNATURE----- --tYqdTR6Mwu/xEI6p--