stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/sun4i: dsi: Avoid hotplug race with DRM driver bind
@ 2020-02-17  6:09 Samuel Holland
  2020-02-19 15:57 ` Maxime Ripard
  0 siblings, 1 reply; 2+ messages in thread
From: Samuel Holland @ 2020-02-17  6:09 UTC (permalink / raw)
  To: Maxime Ripard, Chen-Yu Tsai, David Airlie, Daniel Vetter, dri-devel
  Cc: linux-arm-kernel, linux-kernel, stable, Samuel Holland

We need to make sure that the DRM driver is fully registered before
allowing the panel to be attached. Otherwise, we may trigger a hotplug
event before sun4i_framebuffer_init() sets up drm->mode_config.funcs,
causing a NULL pointer dereference.

Fixes: 1a2703bd7356 ("drm/sun4i: dsi: Allow binding the host without a panel")
Signed-off-by: Samuel Holland <samuel@sholland.org>
---

This fixes a bug in my previous patch series, that I didn't catch until
it was already merged.

---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index 9aa78c73873c..9cc1bb69fcda 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -970,7 +970,7 @@ static int sun6i_dsi_attach(struct mipi_dsi_host *host,
 
 	if (IS_ERR(panel))
 		return PTR_ERR(panel);
-	if (!dsi->drm)
+	if (!dsi->drm || !dsi->drm->registered)
 		return -EPROBE_DEFER;
 
 	dsi->panel = panel;
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/sun4i: dsi: Avoid hotplug race with DRM driver bind
  2020-02-17  6:09 [PATCH] drm/sun4i: dsi: Avoid hotplug race with DRM driver bind Samuel Holland
@ 2020-02-19 15:57 ` Maxime Ripard
  0 siblings, 0 replies; 2+ messages in thread
From: Maxime Ripard @ 2020-02-19 15:57 UTC (permalink / raw)
  To: Samuel Holland
  Cc: Chen-Yu Tsai, David Airlie, Daniel Vetter, dri-devel,
	linux-arm-kernel, linux-kernel, stable

[-- Attachment #1: Type: text/plain, Size: 512 bytes --]

On Mon, Feb 17, 2020 at 12:09:06AM -0600, Samuel Holland wrote:
> We need to make sure that the DRM driver is fully registered before
> allowing the panel to be attached. Otherwise, we may trigger a hotplug
> event before sun4i_framebuffer_init() sets up drm->mode_config.funcs,
> causing a NULL pointer dereference.
>
> Fixes: 1a2703bd7356 ("drm/sun4i: dsi: Allow binding the host without a panel")
> Signed-off-by: Samuel Holland <samuel@sholland.org>

Thanks for following up on this, I've applied it

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-02-19 15:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-17  6:09 [PATCH] drm/sun4i: dsi: Avoid hotplug race with DRM driver bind Samuel Holland
2020-02-19 15:57 ` Maxime Ripard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).