mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
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: d4c2c99bdc
("drm/nouveau/dp: remove broken display depth function, use the improved one")
Signed-off-by: Natalia Petrova <n.petrova@fintech.ru>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230512111526.82408-1-n.petrova@fintech.ru
This commit is contained in:
parent
95011f267c
commit
20a2ce87fb
1 changed files with 2 additions and 2 deletions
|
@ -966,7 +966,7 @@ nouveau_connector_get_modes(struct drm_connector *connector)
|
||||||
/* Determine display colour depth for everything except LVDS now,
|
/* Determine display colour depth for everything except LVDS now,
|
||||||
* DP requires this before mode_valid() is called.
|
* DP requires this before mode_valid() is called.
|
||||||
*/
|
*/
|
||||||
if (connector->connector_type != DRM_MODE_CONNECTOR_LVDS)
|
if (connector->connector_type != DRM_MODE_CONNECTOR_LVDS && nv_connector->native_mode)
|
||||||
nouveau_connector_detect_depth(connector);
|
nouveau_connector_detect_depth(connector);
|
||||||
|
|
||||||
/* Find the native mode if this is a digital panel, if we didn't
|
/* 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)
|
||||||
* "native" mode as some VBIOS tables require us to use the
|
* "native" mode as some VBIOS tables require us to use the
|
||||||
* pixel clock as part of the lookup...
|
* pixel clock as part of the lookup...
|
||||||
*/
|
*/
|
||||||
if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS)
|
if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS && nv_connector->native_mode)
|
||||||
nouveau_connector_detect_depth(connector);
|
nouveau_connector_detect_depth(connector);
|
||||||
|
|
||||||
if (nv_encoder->dcb->type == DCB_OUTPUT_TV)
|
if (nv_encoder->dcb->type == DCB_OUTPUT_TV)
|
||||||
|
|
Loading…
Add table
Reference in a new issue