Received: by 2002:a05:7412:f584:b0:e2:908c:2ebd with SMTP id eh4csp1094809rdb; Mon, 4 Sep 2023 02:56:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEJlSSaGj799TwF4tJ2HsLeE1kmGPtUil7ufosIskfkclczLsAhSlj0LXS1AMTYwLB840yn X-Received: by 2002:a17:906:2092:b0:9a2:86b:bb18 with SMTP id 18-20020a170906209200b009a2086bbb18mr8097833ejq.26.1693821398733; Mon, 04 Sep 2023 02:56:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693821398; cv=none; d=google.com; s=arc-20160816; b=q/4jAq8Wj2t+gzTzIDkHTBUSon8wc5wAgRJ07PkPSp3mYW5NnDXlur+NXKcjCEFuZs NgavHpijZaOgUXv06A0d4HDzpv+BuzhpP6K14hsb2leI5228Z6oJjQ96DTR8l6c5eUb0 sbNh2CfikCqTaRxIK0ZV53/EWEQ87Xc0aWMhWaZLTNOHSoigG1RgsK4rcEnQ8YYWmuHU SZwNrigxXngdtK6iphRi4ib5qe0hC+wpd8xq7QDf0xLNmjUtBR+xxiAv9Np4wqkuCO2u UcUhA6smbgM+yNTxwmxKb2oqKGZHOtqGTc46e477PTzt7ZB9T0VZ0acbjz7s42R1nVPk 69qA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=XcSo3Spyd3peDcjzflCFCScb83JaVwSA5Q2X+aOS4Uk=; fh=1njZQlDVsQ9FzBsSSiXICM+nFfvZ9TB9j2L6lJjH1es=; b=Tptign/WA+X0F/OeNgAadsJzu3A2fXGbDFkxQorXDrUx7+CuCIhqriIapf01vOEUuX /nhPeuG9Ezgl/W2rPiilERNxgsnsLSFOGzk9t+X5hZZX3mS/ryuX6sKA+1CpTIJCyAQz SgqRVKfDI9MH/AbHSZ+BqeZc4Zq2+hW74xjbPUBIppbddseGJ6H7JdLTrmjVJOeM4zjw LhdeAQoPh7Dq+/JIPya6ZXBlQoe/lsa6/jd4H2h/1+PLC0QXs/XrT+HHHAVvzyVvTXVw HewnopSKZzCHJq6pYnGCp0+/ppitA/+gYcBt3Eppx93qQesbnG79NLHvwvheEbc4AWck j0Zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=QeQB1BKw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f17-20020a1709067f9100b009a2040eee09si6231822ejr.614.2023.09.04.02.56.13; Mon, 04 Sep 2023 02:56:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=QeQB1BKw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344480AbjIAI7B (ORCPT + 99 others); Fri, 1 Sep 2023 04:59:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231297AbjIAI7A (ORCPT ); Fri, 1 Sep 2023 04:59:00 -0400 Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4478D10D4 for ; Fri, 1 Sep 2023 01:58:57 -0700 (PDT) Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 3818wUXb045711; Fri, 1 Sep 2023 03:58:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1693558710; bh=XcSo3Spyd3peDcjzflCFCScb83JaVwSA5Q2X+aOS4Uk=; h=Date:From:To:CC:Subject:References:In-Reply-To; b=QeQB1BKwA/AVw38gesLnwCoUATHjkn1SVN/ttukb8HRG4ib00oGitWHA7eTeXgiVD w4YfQkHPu6saTb+NNMMgTUXG9TKywiuyVCp79WVVn8HNNy7SNro3Zap//ikA4TsY9a tqSjl9BtDNl6sC1It8fXbpTt4+1HFQ6nudEV8c6g= Received: from DFLE107.ent.ti.com (dfle107.ent.ti.com [10.64.6.28]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 3818wUGt073983 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 1 Sep 2023 03:58:30 -0500 Received: from DFLE107.ent.ti.com (10.64.6.28) by DFLE107.ent.ti.com (10.64.6.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Fri, 1 Sep 2023 03:58:29 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE107.ent.ti.com (10.64.6.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Fri, 1 Sep 2023 03:58:29 -0500 Received: from localhost (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 3818wS4u057677; Fri, 1 Sep 2023 03:58:29 -0500 Date: Fri, 1 Sep 2023 14:28:30 +0530 From: Jai Luthra To: Aradhya Bhatia CC: Phong LE , Neil Armstrong , Andrzej Hajda , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter , Nicolas Belin , "Andy.Hsieh" , , , , , , Helen Mae Koike Fornazier Subject: Re: [PATCH] drm: bridge: it66121: Fix invalid connector dereference Message-ID: References: <20230825-it66121_edid-v1-1-3ab54923e472@ti.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="h4avs5zu4gsb4w7f" Content-Disposition: inline In-Reply-To: X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --h4avs5zu4gsb4w7f Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Aradhya, Thanks for the comments. On Aug 28, 2023 at 16:34:30 +0530, Aradhya Bhatia wrote: > Hi Jai, >=20 > Thanks for debugging the issue. >=20 > On 25-Aug-23 16:32, Jai Luthra wrote: > > Fix the NULL pointer dereference when no monitor is connected, and the > > sound card is opened from userspace. > >=20 > > Instead return an error as EDID information cannot be provided to > > the sound framework if there is no connector attached. > >=20 > > Fixes: e0fd83dbe924 ("drm: bridge: it66121: Add audio support") > > Reported-by: Nishanth Menon > > Closes: https://lore.kernel.org/all/20230825105849.crhon42qndxqif4i@gon= dola/ > > Signed-off-by: Jai Luthra > > --- > > drivers/gpu/drm/bridge/ite-it66121.c | 5 +++++ > > 1 file changed, 5 insertions(+) > >=20 > > diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bri= dge/ite-it66121.c > > index 466641c77fe9..d6fa00dea464 100644 > > --- a/drivers/gpu/drm/bridge/ite-it66121.c > > +++ b/drivers/gpu/drm/bridge/ite-it66121.c > > @@ -1446,6 +1446,11 @@ static int it66121_audio_get_eld(struct device *= dev, void *data, > > { > > struct it66121_ctx *ctx =3D dev_get_drvdata(dev); > > =20 > > + if (!ctx->connector) { > > + dev_dbg(dev, "No connector present, cannot provide EDID data"); > > + return -EINVAL; > > + } > > + >=20 > There are not many HDMI bridges that support codecs in the kernel, but > upon a quick look, bridge/analogix/anx7625.c and > bridge/synopsys/dw-hdmi* gracefully return a buffer of 0s when the > connector is unavailable. Interesting, that sounds cleaner to me. >=20 > I am not sure why that is done, but I also don't see the hdmi-codec > driver handle the 0s situation properly. It is business as usual for the > hdmi-codec. Chasing this down through the hdmi-codec driver and sound framework, it=20 will use sane defaults for supported channels and sample rates if the=20 actual EDID struct we are passing is all 0s. I tested it out on the=20 beagle play board and did not see any crashes. >=20 > Did you come across some observation when you were testing? Yes, with the current state of the patch, if I plug-in a monitor after=20 the soundcard is probed I cannot playback audio, because we returned an=20 error initially. This issue goes away if we return a buffer of 0s like those other=20 bridges. Overall I'm happy with this idea, so I will send a v2 fixing=20 this. >=20 > Regards > Aradhya >=20 > > mutex_lock(&ctx->lock); > > =20 > > memcpy(buf, ctx->connector->eld, > >=20 > > --- > > base-commit: 6269320850097903b30be8f07a5c61d9f7592393 > > change-id: 20230825-it66121_edid-6ee98517808b > >=20 > > Best regards, >=20 --=20 Thanks, Jai GPG Fingerprint: 4DE0 D818 E5D5 75E8 D45A AFC5 43DE 91F9 249A 7145 --h4avs5zu4gsb4w7f Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEETeDYGOXVdejUWq/FQ96R+SSacUUFAmTxp7MACgkQQ96R+SSa cUWB1BAA1POMzZ6VOKt9P5havK6UGc1Vh3QvEguAY6I2hvSKSdG6KpOGzGgDJpXS BE+imKr6mK4p6hwVbsLqiv1Ov1ZpthUfyY3Q4/Tq2A5HfleUAQlOsQe2Ug8Iqhab Y83Bi1qVZ7P+AWAmzWZemFphNy2Aurq5in0yUaks0H4uQu+A8PITsk8PAmY3Ryul POeTvXAsWaPvUkZY9TXJbp3T9DWWLoiHBuk+hiZKKOgXKjuCtR8m2x4zgqb13hMo L7cL7j0p1m5Eu83CGctvuMY+3hCxhB0eVS8UfbJ4D9GdQC7zpks0890ZUElwhQl0 B4HpAvAwWbx01y9Tyydv3vzMwdcB1DVCY/UPpMIUSgBMHo4RJwbY5QRs+vqJ2JuS 9KWkJyQZZ9uBRX5BeP6ZK0UcI/Lgx6fmnxcOAWdL9xCEUW5u1rKx/14y0vWmXb3R +dagmYuPxGAxh49Sswfwv0W+kEf7d1vgJpNLVwzQmmcfuDmGCZCGJVOrleCjPkTE hgaTqOMOLlr5b8CyXw2IvCl3eRA1lOYu33xUs3Tg9iD/voy8d0QSb7Eih9VWXd+K wdnPXz0Z8ChK6PR4UZ07mni/BS9KisDRg3dbSrcDx3vhtD9pp+VmmyojLODhR2+5 ougvzQssnbpKaBKm3KEkVPVbT3r0W4d/Y5z6/oiGN0bhXaqps1c= =CxMm -----END PGP SIGNATURE----- --h4avs5zu4gsb4w7f--