drm: mxsfb: Fix NULL pointer dereference crash on unload
Subsystems (4)
Marek Vasut
maintainerPATCH 1/1 drm: mxsfb: Fix NULL pointer dereference crash on unload
The mxsfb->crtc.funcs may already be NULL when unloading the driver, in which case calling mxsfb_irq_disable() via drm_irq_uninstall() from mxsfb_unload() leads to NULL pointer dereference.
Since all we care about is masking the IRQ and mxsfb->base is still valid, just use that to clear and mask the IRQ.
Fixes ae1ed00932819 ("drm: mxsfb: Stop using DRM simple display pipeline helper")
Signed-off-by Marek Vasut <[email protected]>
Cc Daniel Abrecht <[email protected]>
Cc Emil Velikov <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Sam Ravnborg <[email protected]>
Cc Stefan Agner <[email protected]>
--- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/mxsfb/mxsfb_drv.c +5 -1
@@ -173,7 +173,11 @@ static void mxsfb_irq_disable(struct drm_device *drm)struct mxsfb_drm_private *mxsfb = drm->dev_private;mxsfb_enable_axi_clk (mxsfb); - mxsfb->crtc.funcs->disable_vblank (&mxsfb->crtc); + +/* Disable and clear VBLANK IRQ */ +writel (CTRL1_CUR_FRAME_DONE_IRQ_EN , mxsfb->base +LCDC_CTRL1 +REG_CLR ); +writel (CTRL1_CUR_FRAME_DONE_IRQ , mxsfb->base +LCDC_CTRL1 +REG_CLR ); +mxsfb_disable_axi_clk (mxsfb); }
Signature · 1 line
2.33.0
Sam Ravnborg
AppliedHi Marek,
Quoted 7 lines · Marek Vasut
The
mxsfb->crtc.funcsmay already be NULL when unloading the driver, in which case callingmxsfb_irq_disable()viadrm_irq_uninstall()frommxsfb_unload()leads to NULL pointer dereference.Since all we care about is masking the IRQ and
mxsfb->baseis still valid, just use that to clear and mask the IRQ.
Quoted 7 lines
Fixes ae1ed00932819 ("drm: mxsfb: Stop using DRM simple display pipeline helper")Signed-off-by Marek Vasut <[email protected]>Cc Daniel Abrecht <[email protected]>Cc Emil Velikov <[email protected]>Cc Laurent Pinchart <[email protected]>Cc Sam Ravnborg <[email protected]>Cc Stefan Agner <[email protected]>
Applied to drm-misc-fixes.
Sam