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 76518CA0FE6 for ; Fri, 1 Sep 2023 11:32:53 +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=7bqRJMsXbahmYBGfQJoRaDSyDNcpLar2dyUU/EgPrmA=; b=VGDJaFll+C9UhE 8GAbFQFyf4QusEiLCfLEKZhJELt8wi/kpEWdGxPcziK7L2/Wf4YDuf0XbkFhwCycmJY910Wgmf19F nq7Cel3RSWQayjUr7AW47Xysdu4Fx1aKwvk1OJos7yDMUJHOIQD5pl6pspiW/q4WgADv/g1rp1/v8 Dxh7V7ZNt24Er1BoQfbOcO4lgceRSNK2uZh8kqbHBi0PLrLKcQ0hmGn1Yx3f2rHQ6LOG9iNeSLbN9 xFLvw2+VhfLnS+s2dTTvOHahtK4qtQ9JmT8ClLe9+tDTSfOtSLKodNo4mqMSnyn4FQJdUiNY/N+jT q0zDGIi01kJy54TVJqtA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qc2Nw-00HFlH-1L; Fri, 01 Sep 2023 11:32:20 +0000 Received: from lelv0142.ext.ti.com ([198.47.23.249]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qc2Ns-00HFk4-22 for linux-arm-kernel@lists.infradead.org; Fri, 01 Sep 2023 11:32:18 +0000 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 381BVpjf036112; Fri, 1 Sep 2023 06:31:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1693567911; bh=SYdFRxXFU6erJ9Dh1t1hgvxPkK69MKAAgIlxHB5BT4g=; h=Date:Subject:To:CC:References:From:In-Reply-To; b=MEDRj3xZw+6dV+NMmmX3rKGISboFg4t4tOFexgXRtcj10RFG5VALtz7SYQp7qBDcy GkPpUKL2xtcOc5J/T6gisLlVCmcimtYbtjwztPRaQwxH2id02VzpUOksyP7pLTTRl6 qrTrqJhKEX5ly6fR+8xaV5wFhYF5hQldryloafT8= Received: from DFLE106.ent.ti.com (dfle106.ent.ti.com [10.64.6.27]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 381BVpJE000326 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 1 Sep 2023 06:31:51 -0500 Received: from DFLE115.ent.ti.com (10.64.6.36) by DFLE106.ent.ti.com (10.64.6.27) 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 06:31:49 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE115.ent.ti.com (10.64.6.36) 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 06:31:49 -0500 Received: from [172.24.227.132] (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 381BVN55036338; Fri, 1 Sep 2023 06:31:32 -0500 Message-ID: Date: Fri, 1 Sep 2023 17:01:23 +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 v2] 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: Helen Koike , , , , , References: <20230901-it66121_edid-v2-1-aa59605336b9@ti.com> Content-Language: en-US From: Aradhya Bhatia In-Reply-To: <20230901-it66121_edid-v2-1-aa59605336b9@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-20230901_043216_768507_DE153EBD X-CRM114-Status: GOOD ( 17.68 ) 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 On 01-Sep-23 15:01, Jai Luthra wrote: > Fix the NULL pointer dereference when no monitor is connected, and the > sound card is opened from userspace. > > Instead return an empty buffer (of zeroes) as the EDID information 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/ > Reviewed-by: Helen Koike > Signed-off-by: Jai Luthra Reviewed-by: Aradhya Bhatia Regards Aradhya > --- > Changes in v2: > - Return an empty buffer of 0s instead of returning an error > - Lock the mutex before accessing ctx->connector > - Link to v1: https://lore.kernel.org/r/20230825-it66121_edid-v1-1-3ab54923e472@ti.com > --- > drivers/gpu/drm/bridge/ite-it66121.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bridge/ite-it66121.c > index 466641c77fe9..fc7f5ec5fb38 100644 > --- a/drivers/gpu/drm/bridge/ite-it66121.c > +++ b/drivers/gpu/drm/bridge/ite-it66121.c > @@ -1447,10 +1447,14 @@ static int it66121_audio_get_eld(struct device *dev, void *data, > struct it66121_ctx *ctx = dev_get_drvdata(dev); > > mutex_lock(&ctx->lock); > - > - memcpy(buf, ctx->connector->eld, > - min(sizeof(ctx->connector->eld), len)); > - > + if (!ctx->connector) { > + /* Pass en empty ELD if connector not available */ > + dev_dbg(dev, "No connector present, passing empty EDID data"); > + memset(buf, 0, len); > + } else { > + memcpy(buf, ctx->connector->eld, > + min(sizeof(ctx->connector->eld), len)); > + } > mutex_unlock(&ctx->lock); > > return 0; > > --- > base-commit: 99d99825fc075fd24b60cc9cf0fb1e20b9c16b0f > 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