diff mbox series

drm: Add check for encoder in intel_get_crtc_new_encoder()

Message ID 20240924104722.1049588-1-g.ryurikov@securitycode.ru (mailing list archive)
State New, archived
Headers show
Series drm: Add check for encoder in intel_get_crtc_new_encoder() | expand

Commit Message

George Rurikov Sept. 24, 2024, 10:47 a.m. UTC
If the video card driver could not find the connector assigned to the
current video controller, or if the hardware status has changed so that
a pre-existing connector is no longer active, none of the state
connectors will meet the assignment criteria for the current crtc video
controller.

In the drm_WARN function, encoder->base.dev is called, so
'&encoder->base.dev' will be dereferenced since encoder will still be
initialized NULL.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: e12d6218fda2 ("drm/i915: Reduce bigjoiner special casing")
Cc: stable@vger.kernel.org
Signed-off-by: George Rurikov <g.ryurikov@securitycode.ru>
---
 drivers/gpu/drm/i915/display/intel_display.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

--
2.34.1

Заявление о конфиденциальности

Данное электронное письмо и любые приложения к нему являются конфиденциальными и предназначены исключительно для адресата. Если Вы не являетесь адресатом данного письма, пожалуйста, уведомите немедленно отправителя, не раскрывайте содержание другим лицам, не используйте его в каких-либо целях, не храните и не копируйте информацию любым способом.
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index b4ef4d59da1a..a5e24d64f909 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -819,9 +819,10 @@  intel_get_crtc_new_encoder(const struct intel_atomic_state *state,
                num_encoders++;
        }

-       drm_WARN(state->base.dev, num_encoders != 1,
-                "%d encoders for pipe %c\n",
-                num_encoders, pipe_name(primary_crtc->pipe));
+       if (encoder)
+               drm_WARN(state->base.dev, num_encoders != 1,
+                       "%d encoders for pipe %c\n",
+                       num_encoders, pipe_name(primary_crtc->pipe));

        return encoder;
 }