diff options
author | Alexander Stein <alexander.stein@ew.tq-group.com> | 2022-02-02 11:17:55 +0300 |
---|---|---|
committer | Marek Vasut <marex@denx.de> | 2022-02-03 11:31:16 +0300 |
commit | 622c9a3a7868e1eeca39c55305ca3ebec4742b64 (patch) | |
tree | ed249fb464b88f5130609e81333580cc0d9f62c7 | |
parent | a3f781a9d6114c1d1e01defb7aa234dec45d2a5f (diff) | |
download | linux-622c9a3a7868e1eeca39c55305ca3ebec4742b64.tar.xz |
drm: mxsfb: Fix NULL pointer dereference
mxsfb should not ever dereference the NULL pointer which
drm_atomic_get_new_bridge_state is allowed to return.
Assume a fixed format instead.
Fixes: b776b0f00f24 ("drm: mxsfb: Use bus_format from the nearest bridge if present")
Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20220202081755.145716-3-alexander.stein@ew.tq-group.com
-rw-r--r-- | drivers/gpu/drm/mxsfb/mxsfb_kms.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/gpu/drm/mxsfb/mxsfb_kms.c b/drivers/gpu/drm/mxsfb/mxsfb_kms.c index 0655582ae8ed..4cfb6c001679 100644 --- a/drivers/gpu/drm/mxsfb/mxsfb_kms.c +++ b/drivers/gpu/drm/mxsfb/mxsfb_kms.c @@ -361,7 +361,11 @@ static void mxsfb_crtc_atomic_enable(struct drm_crtc *crtc, bridge_state = drm_atomic_get_new_bridge_state(state, mxsfb->bridge); - bus_format = bridge_state->input_bus_cfg.format; + if (!bridge_state) + bus_format = MEDIA_BUS_FMT_FIXED; + else + bus_format = bridge_state->input_bus_cfg.format; + if (bus_format == MEDIA_BUS_FMT_FIXED) { dev_warn_once(drm->dev, "Bridge does not provide bus format, assuming MEDIA_BUS_FMT_RGB888_1X24.\n" |