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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1F79FC83F12 for ; Mon, 28 Aug 2023 11:05:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:CC:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=AXsELkINKP19pm110ZVfyxCKJ93k2JlNpg+3OybP+MY=; b=VG9QliL+MezmKS 1RTNeKXq/DTagiXYmKFThEBgHfs+u4SN3yC1eMD1VyhqufhL4iSXaaCG2/7x/dHB1XRJNKeB6UPn8 HrNXXdo3qCoqer7c2gDu4Bk6bPL2Ej8ox3w8cJF+dVjQa4SLuVa+8+JL/CjZMNP3puDbVrya7qg0M +IHIAeSEuojfkHB7Xjk9IAkFEzZzlfWJrVgBjIQPTXXjiPd74UBa+LuuCvNU9IVkRtOo6ALQR52SZ zW4Sl1dH0lOTaSpe96UZIb8Ds7iNYiOBWS6+1x86dzzGAu2o+RcsKNbUXc2JNAjXng+Q3Tj7TxYEG g1NayXBnfS5PX607a4Qw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qaa3G-009Tc3-2p; Mon, 28 Aug 2023 11:04:58 +0000 Received: from fllv0016.ext.ti.com ([198.47.19.142]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qaa3D-009Tb8-0i for linux-arm-kernel@lists.infradead.org; Mon, 28 Aug 2023 11:04:57 +0000 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 37SB4aIC113761; Mon, 28 Aug 2023 06:04:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1693220676; bh=Wg5gLNloF2HPALm7TXuVipHiVIXcFi/HXierxrbJZJg=; h=Date:Subject:To:CC:References:From:In-Reply-To; b=pV4kqEFk4DaIWp9X3lNVyJDl2XyqWC4hfAKgEUWp7jrrXakRaJKlhN4nugKEnYxwl W/+hpEQWG8k3iVv6qMO3Yo0k2y+dRzhgwNRTm9k/8OBzXNKIy06utMi7ZObMRb1sRU ocIP+ZpKMuOu/dGx/Wg2I2FM2Lee/SZDr99s7L7I= Received: from DLEE113.ent.ti.com (dlee113.ent.ti.com [157.170.170.24]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 37SB4aI9090914 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 28 Aug 2023 06:04:36 -0500 Received: from DLEE100.ent.ti.com (157.170.170.30) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 28 Aug 2023 06:04:36 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE100.ent.ti.com (157.170.170.30) 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; Mon, 28 Aug 2023 06:04:36 -0500 Received: from [172.24.227.132] (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 37SB4U9T020731; Mon, 28 Aug 2023 06:04:31 -0500 Message-ID: Date: Mon, 28 Aug 2023 16:34:30 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Subject: Re: [PATCH] drm: bridge: it66121: Fix invalid connector dereference To: Jai Luthra , Phong LE , Neil Armstrong , Andrzej Hajda , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter , Nicolas Belin , "Andy.Hsieh" CC: , , , , References: <20230825-it66121_edid-v1-1-3ab54923e472@ti.com> Content-Language: en-US From: Aradhya Bhatia In-Reply-To: <20230825-it66121_edid-v1-1-3ab54923e472@ti.com> X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230828_040455_424304_081B3DD8 X-CRM114-Status: GOOD ( 18.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Jai, Thanks for debugging the issue. 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. > > Instead return an error as EDID information cannot be provided to > the sound framework if there is no connector attached. > > Fixes: e0fd83dbe924 ("drm: bridge: it66121: Add audio support") > Reported-by: Nishanth Menon > Closes: https://lore.kernel.org/all/20230825105849.crhon42qndxqif4i@gondola/ > Signed-off-by: Jai Luthra > --- > drivers/gpu/drm/bridge/ite-it66121.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bridge/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 = dev_get_drvdata(dev); > > + if (!ctx->connector) { > + dev_dbg(dev, "No connector present, cannot provide EDID data"); > + return -EINVAL; > + } > + 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. 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. Did you come across some observation when you were testing? Regards Aradhya > mutex_lock(&ctx->lock); > > memcpy(buf, ctx->connector->eld, > > --- > base-commit: 6269320850097903b30be8f07a5c61d9f7592393 > change-id: 20230825-it66121_edid-6ee98517808b > > Best regards, _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel