Skip to contentSkip to conversation

FAILED: patch "[PATCH] drm: mxsfb: Fix NULL pointer dereference" failed to apply to 5.15-stable tree

PATCH [email protected] 1 participant 1 message Feb 6, 2022

Subsystems (5)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 622c9a3a7868e1eeca39c55305ca3ebec4742b64 Mon Sep 17 00:00:00 2001
From: Alexander Stein <[email protected]>
Date: Wed, 2 Feb 2022 09:17:55 +0100
Subject: [PATCH] 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")
drivers/gpu/drm/mxsfb/mxsfb_kms.c +5 -1
index 0655582ae8ed..4cfb6c001679 100644
@@ -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"