瀏覽代碼

Merge tag 'drm-misc-fixes-2018-11-07' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes

- sun4i: tcon->panel NULL deref protections (Giulio)

Cc: Giulio Benetti <giulio.benetti@micronovasrl.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Sean Paul <sean@poorly.run>
Link: https://patchwork.freedesktop.org/patch/msgid/20181107205051.GA27823@art_vandelay
Dave Airlie 6 年之前
父節點
當前提交
d10cf6da31
共有 3 個文件被更改,包括 7 次插入6 次删除
  1. 2 2
      drivers/gpu/drm/sun4i/sun4i_lvds.c
  2. 2 2
      drivers/gpu/drm/sun4i/sun4i_rgb.c
  3. 3 2
      drivers/gpu/drm/sun4i/sun4i_tcon.c

+ 2 - 2
drivers/gpu/drm/sun4i/sun4i_lvds.c

@@ -75,7 +75,7 @@ static void sun4i_lvds_encoder_enable(struct drm_encoder *encoder)
 
 
 	DRM_DEBUG_DRIVER("Enabling LVDS output\n");
 	DRM_DEBUG_DRIVER("Enabling LVDS output\n");
 
 
-	if (!IS_ERR(tcon->panel)) {
+	if (tcon->panel) {
 		drm_panel_prepare(tcon->panel);
 		drm_panel_prepare(tcon->panel);
 		drm_panel_enable(tcon->panel);
 		drm_panel_enable(tcon->panel);
 	}
 	}
@@ -88,7 +88,7 @@ static void sun4i_lvds_encoder_disable(struct drm_encoder *encoder)
 
 
 	DRM_DEBUG_DRIVER("Disabling LVDS output\n");
 	DRM_DEBUG_DRIVER("Disabling LVDS output\n");
 
 
-	if (!IS_ERR(tcon->panel)) {
+	if (tcon->panel) {
 		drm_panel_disable(tcon->panel);
 		drm_panel_disable(tcon->panel);
 		drm_panel_unprepare(tcon->panel);
 		drm_panel_unprepare(tcon->panel);
 	}
 	}

+ 2 - 2
drivers/gpu/drm/sun4i/sun4i_rgb.c

@@ -135,7 +135,7 @@ static void sun4i_rgb_encoder_enable(struct drm_encoder *encoder)
 
 
 	DRM_DEBUG_DRIVER("Enabling RGB output\n");
 	DRM_DEBUG_DRIVER("Enabling RGB output\n");
 
 
-	if (!IS_ERR(tcon->panel)) {
+	if (tcon->panel) {
 		drm_panel_prepare(tcon->panel);
 		drm_panel_prepare(tcon->panel);
 		drm_panel_enable(tcon->panel);
 		drm_panel_enable(tcon->panel);
 	}
 	}
@@ -148,7 +148,7 @@ static void sun4i_rgb_encoder_disable(struct drm_encoder *encoder)
 
 
 	DRM_DEBUG_DRIVER("Disabling RGB output\n");
 	DRM_DEBUG_DRIVER("Disabling RGB output\n");
 
 
-	if (!IS_ERR(tcon->panel)) {
+	if (tcon->panel) {
 		drm_panel_disable(tcon->panel);
 		drm_panel_disable(tcon->panel);
 		drm_panel_unprepare(tcon->panel);
 		drm_panel_unprepare(tcon->panel);
 	}
 	}

+ 3 - 2
drivers/gpu/drm/sun4i/sun4i_tcon.c

@@ -491,7 +491,8 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
 	sun4i_tcon0_mode_set_common(tcon, mode);
 	sun4i_tcon0_mode_set_common(tcon, mode);
 
 
 	/* Set dithering if needed */
 	/* Set dithering if needed */
-	sun4i_tcon0_mode_set_dithering(tcon, tcon->panel->connector);
+	if (tcon->panel)
+		sun4i_tcon0_mode_set_dithering(tcon, tcon->panel->connector);
 
 
 	/* Adjust clock delay */
 	/* Adjust clock delay */
 	clk_delay = sun4i_tcon_get_clk_delay(mode, 0);
 	clk_delay = sun4i_tcon_get_clk_delay(mode, 0);
@@ -555,7 +556,7 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
 	 * Following code is a way to avoid quirks all around TCON
 	 * Following code is a way to avoid quirks all around TCON
 	 * and DOTCLOCK drivers.
 	 * and DOTCLOCK drivers.
 	 */
 	 */
-	if (!IS_ERR(tcon->panel)) {
+	if (tcon->panel) {
 		struct drm_panel *panel = tcon->panel;
 		struct drm_panel *panel = tcon->panel;
 		struct drm_connector *connector = panel->connector;
 		struct drm_connector *connector = panel->connector;
 		struct drm_display_info display_info = connector->display_info;
 		struct drm_display_info display_info = connector->display_info;