[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <99e8032d-9a40-77a2-51a2-14bd8c3913cd@denx.de>
Date: Thu, 17 Jun 2021 14:49:53 +0200
From: Marek Vasut <marex@...x.de>
To: Jonathan Liu <net147@...il.com>, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org
Cc: Andrzej Hajda <a.hajda@...sung.com>,
Neil Armstrong <narmstrong@...libre.com>,
Robert Foss <robert.foss@...aro.org>,
Laurent Pinchart <Laurent.pinchart@...asonboard.com>,
Jonas Karlman <jonas@...boo.se>,
Jernej Skrabec <jernej.skrabec@...il.com>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
Linus Walleij <linus.walleij@...aro.org>,
Frieder Schrempf <frieder.schrempf@...tron.de>
Subject: Re: [PATCH] drm/bridge: ti-sn65dsi83: Fix null pointer dereference in
remove callback
On 6/17/21 1:19 PM, Jonathan Liu wrote:
> If attach has not been called, unloading the driver can result in a null
> pointer dereference in mipi_dsi_detach as ctx->dsi has not been assigned
> yet.
>
> Fixes: ceb515ba29ba6b ("drm/bridge: ti-sn65dsi83: Add TI SN65DSI83 and SN65DSI84 driver")
> Signed-off-by: Jonathan Liu <net147@...il.com>
> ---
> drivers/gpu/drm/bridge/ti-sn65dsi83.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
> index 750f2172ef08..8e9f45c5c7c1 100644
> --- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c
> +++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
> @@ -671,8 +671,11 @@ static int sn65dsi83_remove(struct i2c_client *client)
> {
> struct sn65dsi83 *ctx = i2c_get_clientdata(client);
>
> - mipi_dsi_detach(ctx->dsi);
> - mipi_dsi_device_unregister(ctx->dsi);
> + if (ctx->dsi) {
> + mipi_dsi_detach(ctx->dsi);
> + mipi_dsi_device_unregister(ctx->dsi);
> + }
> +
> drm_bridge_remove(&ctx->bridge);
> of_node_put(ctx->host_node);
Looks OK to me.
Reviewed-by: Marek Vasut <marex@...x.de>
Thanks !
Powered by blists - more mailing lists