Explorar o código

drm/crtc_helper: avoid NULL-pointer dereference when encoder is NULL

Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
Maarten Maathuis %!s(int64=16) %!d(string=hai) anos
pai
achega
ff6fdbed8f
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      drivers/gpu/drm/drm_crtc_helper.c

+ 2 - 1
drivers/gpu/drm/drm_crtc_helper.c

@@ -842,7 +842,8 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
 			/* If the encoder is reused for another connector, then
 			 * the appropriate crtc will be set later.
 			 */
-			connector->encoder->crtc = NULL;
+			if (connector->encoder)
+				connector->encoder->crtc = NULL;
 			connector->encoder = new_encoder;
 		}
 	}