Skip to content

Commit 20a2ce8

Browse files
Natalia PetrovaLyude
authored andcommitted
drm/nouveau/dp: check for NULL nv_connector->native_mode
Add checking for NULL before calling nouveau_connector_detect_depth() in nouveau_connector_get_modes() function because nv_connector->native_mode could be dereferenced there since connector pointer passed to nouveau_connector_detect_depth() and the same value of nv_connector->native_mode is used there. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: d4c2c99 ("drm/nouveau/dp: remove broken display depth function, use the improved one") Signed-off-by: Natalia Petrova <[email protected]> Reviewed-by: Lyude Paul <[email protected]> Signed-off-by: Lyude Paul <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 95011f2 commit 20a2ce8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/gpu/drm/nouveau/nouveau_connector.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,7 @@ nouveau_connector_get_modes(struct drm_connector *connector)
966966
/* Determine display colour depth for everything except LVDS now,
967967
* DP requires this before mode_valid() is called.
968968
*/
969-
if (connector->connector_type != DRM_MODE_CONNECTOR_LVDS)
969+
if (connector->connector_type != DRM_MODE_CONNECTOR_LVDS && nv_connector->native_mode)
970970
nouveau_connector_detect_depth(connector);
971971

972972
/* Find the native mode if this is a digital panel, if we didn't
@@ -987,7 +987,7 @@ nouveau_connector_get_modes(struct drm_connector *connector)
987987
* "native" mode as some VBIOS tables require us to use the
988988
* pixel clock as part of the lookup...
989989
*/
990-
if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS)
990+
if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS && nv_connector->native_mode)
991991
nouveau_connector_detect_depth(connector);
992992

993993
if (nv_encoder->dcb->type == DCB_OUTPUT_TV)

0 commit comments

Comments
 (0)