Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] drm/i915/display: null pointer deref in
  intel_hdcp_required_content_stream() [1]
--

commit dc9e0e29bf2443e79a6b1bc4bcb651f3727d0798
Author: Tzung-Bi Shih <[email protected]>

drm/i915/hdcp: Call drm_connector_list_iter_end() on early return

This commit ensures drm_connector_list_iter_end() is called before
returning -EINVAL when the streams[] bounds check triggers in
intel_hdcp_required_content_stream().

> diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c 
> b/drivers/gpu/drm/i915/display/intel_hdcp.c
> index dad0c854e4fa6..2c1ce65e7f9ad 100644
> --- a/drivers/gpu/drm/i915/display/intel_hdcp.c
> +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c
> @@ -145,8 +145,10 @@ intel_hdcp_required_content_stream(struct 
> intel_atomic_state *state,
>               if (!new_conn_state || !new_conn_state->crtc)
>                       continue;
>  
> -             if (drm_WARN_ON(display->drm, data->k >= 
> INTEL_NUM_PIPES(display)))
> +             if (drm_WARN_ON(display->drm, data->k >= 
> INTEL_NUM_PIPES(display))) {
> +                     drm_connector_list_iter_end(&conn_iter);
>                       return -EINVAL;
> +             }
>  
>               data->streams[data->k].stream_id =
>                       intel_conn_to_vcpi(state, connector);

[Severity: Critical]
This problem wasn't introduced by this patch, but earlier in this loop in
intel_hdcp_required_content_stream(), can intel_encoder_is_mst() trigger a
NULL pointer dereference [1] when evaluating a connected but inactive
MST connector?

drivers/gpu/drm/i915/display/intel_hdcp.c:intel_hdcp_required_content_stream() {
        ...
        for_each_intel_connector_iter(connector, &conn_iter) {
                if (connector->base.status == connector_status_disconnected)
                        continue;

                if (!intel_encoder_is_mst(intel_attached_encoder(connector)))
                        continue;
        ...
}

An inactive connector in an MST topology has no attached encoder, so
intel_attached_encoder() returns NULL and intel_encoder_is_mst()
unconditionally dereferences encoder->type.

[1] https://sashiko.dev/#/bug/linux-e7eb43c9-05b7-4152-87a3-a523da195086

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=1

Reply via email to