[PATCH] drm: rcar-du: lvds: Fix crash in .atomic_check when disabling connector
Kieran Bingham
kieran.bingham at ideasonboard.com
Sat Apr 28 19:58:29 UTC 2018
Hi Laurent,
On 27/04/18 21:20, Laurent Pinchart wrote:
> The connector .atomic_check() handler can be called with a NULL crtc
> pointer in the connector state when the connector gets disabled
> explicitly (through performing a legacy mode set or setting the
> connector's CRTC_ID property to 0). This causes a crash as the crtc
> pointer is dereferenced without any check.
>
> Fix it by returning from the .atomic_check() handler when then crtc
> pointer is NULL, as there is no check to be performed when the connector
> gets disabled.
This sounds fine to me.
> Fixes: c6a27fa41fab ("drm: rcar-du: Convert LVDS encoder code to bridge driver")
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas at ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas at ideasonboard.com>
> ---
> drivers/gpu/drm/rcar-du/rcar_lvds.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> This is a v4.17 regression fix, I will send a pull request in a few days after
> the patch gets reviewed.
>
> diff --git a/drivers/gpu/drm/rcar-du/rcar_lvds.c b/drivers/gpu/drm/rcar-du/rcar_lvds.c
> index 3d2d3bbd1342..155ad840f3c5 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_lvds.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_lvds.c
> @@ -88,6 +88,9 @@ static int rcar_lvds_connector_atomic_check(struct drm_connector *connector,
> const struct drm_display_mode *panel_mode;
> struct drm_crtc_state *crtc_state;
>
> + if (!state->crtc)
> + return 0;
> +
> if (list_empty(&connector->modes)) {
> dev_dbg(lvds->dev, "connector: empty modes list\n");
> return -EINVAL;
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20180428/b9f50540/attachment.sig>
More information about the dri-devel
mailing list