diff mbox

drm/rockchip: only call drm_fb_helper_hotplug_event if fb_helper present

Message ID 1895627.zroongJmBp@diego (mailing list archive)
State New, archived
Headers show

Commit Message

Heiko Stübner June 2, 2015, 2:41 p.m. UTC
Add a check for the presence of fb_helper to rockchip_drm_output_poll_changed()
to only call drm_fb_helper_hotplug_event if there is actually a fb_helper
available. Without this check I see NULL pointer dereferences when the
hdmi hotplug irq fires before the fb_helper got initialized.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
Fix to variant as seen on at least Exynos, Armada and Omap

 drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

yao mark June 3, 2015, 3:41 a.m. UTC | #1
On 2015?06?02? 22:41, Heiko Stübner wrote:
> Add a check for the presence of fb_helper to rockchip_drm_output_poll_changed()
> to only call drm_fb_helper_hotplug_event if there is actually a fb_helper
> available. Without this check I see NULL pointer dereferences when the
> hdmi hotplug irq fires before the fb_helper got initialized.
>
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> ---
> Fix to variant as seen on at least Exynos, Armada and Omap
>
>   drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
> index 77d5289..002645b 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
> @@ -162,7 +162,8 @@ static void rockchip_drm_output_poll_changed(struct drm_device *dev)
>   	struct rockchip_drm_private *private = dev->dev_private;
>   	struct drm_fb_helper *fb_helper = &private->fbdev_helper;
>   
> -	drm_fb_helper_hotplug_event(fb_helper);
> +	if (fb_helper)
> +		drm_fb_helper_hotplug_event(fb_helper);
Thanks for the fix, Applied to my drm-next
>   }
>   
>   static const struct drm_mode_config_funcs rockchip_drm_mode_config_funcs = {
diff mbox

Patch

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
index 77d5289..002645b 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
@@ -162,7 +162,8 @@  static void rockchip_drm_output_poll_changed(struct drm_device *dev)
 	struct rockchip_drm_private *private = dev->dev_private;
 	struct drm_fb_helper *fb_helper = &private->fbdev_helper;
 
-	drm_fb_helper_hotplug_event(fb_helper);
+	if (fb_helper)
+		drm_fb_helper_hotplug_event(fb_helper);
 }
 
 static const struct drm_mode_config_funcs rockchip_drm_mode_config_funcs = {