[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fe786b37-a442-7230-305c-c8bca7cffa2a@ti.com>
Date: Fri, 1 Sep 2023 17:01:23 +0530
From: Aradhya Bhatia <a-bhatia1@...com>
To: Jai Luthra <j-luthra@...com>, Phong LE <ple@...libre.com>,
Neil Armstrong <neil.armstrong@...aro.org>,
Andrzej Hajda <andrzej.hajda@...el.com>,
Robert Foss <rfoss@...nel.org>,
Laurent Pinchart <Laurent.pinchart@...asonboard.com>,
Jonas Karlman <jonas@...boo.se>,
Jernej Skrabec <jernej.skrabec@...il.com>,
David Airlie <airlied@...il.com>,
Daniel Vetter <daniel@...ll.ch>,
Nicolas Belin <nbelin@...libre.com>,
"Andy.Hsieh" <Andy.Hsieh@...iatek.com>
CC: Helen Koike <helen.koike@...labora.com>,
<dri-devel@...ts.freedesktop.org>, <linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>, <devarsht@...com>,
<nm@...com>
Subject: Re: [PATCH v2] drm: bridge: it66121: Fix invalid connector
dereference
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 <nm@...com>
> Closes: https://lore.kernel.org/all/20230825105849.crhon42qndxqif4i@gondola/
> Reviewed-by: Helen Koike <helen.koike@...labora.com>
> Signed-off-by: Jai Luthra <j-luthra@...com>
Reviewed-by: Aradhya Bhatia <a-bhatia1@...com>
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,
Powered by blists - more mailing lists