RE: [PATCH 2/2] drm/i915/hdcp: Fix get remote hdcp capability function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Suraj,

> -----Original Message-----
> From: Kandpal, Suraj <suraj.kandpal@xxxxxxxxx>
> Sent: Monday, April 1, 2024 8:31 AM
> To: intel-gfx@xxxxxxxxxxxxxxxxxxxxx
> Cc: Borah, Chaitanya Kumar <chaitanya.kumar.borah@xxxxxxxxx>; Kandpal,
> Suraj <suraj.kandpal@xxxxxxxxx>
> Subject: [PATCH 2/2] drm/i915/hdcp: Fix get remote hdcp capability function
> 
> HDCP 1.x capability needs to be checked even if setup is not HDCP 2.x capable.
> 
> --v2
> -Assign hdcp_capable and hdcp2_capable to false [Chaitanya]
> 
> Fixes: 813cca96e4ac ("drm/i915/hdcp: Add new remote capability check shim
> function")
> Signed-off-by: Suraj Kandpal <suraj.kandpal@xxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
> b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
> index 179e754e5c30..bd2cd7417136 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
> @@ -694,9 +694,12 @@ int intel_dp_hdcp_get_remote_capability(struct
> intel_connector *connector,
>  	if (!intel_encoder_is_mst(connector->encoder))
>  		return -EINVAL;
> 
> +	hdcp_capable = false;
> +	hdcp2_capable = false;

Here pointers are being overwritten.
Anywhere we try to write to them will lead to crash.

You can also move them above the EINVAL check for the sake of readability. Anyway the caller of this function should not rely on the values if there is error code returned.
(even though no one is doing that right now)

Regards

Chaitanya


>  	ret =  _intel_dp_hdcp2_get_capability(aux, hdcp2_capable);
>  	if (ret)
> -		return ret;
> +		drm_dbg_kms(&i915->drm,
> +			    "HDCP2 DPCD capability read failed err: %d\n", ret);
> 
>  	ret = intel_dp_hdcp_read_bcaps(aux, i915, &bcaps);
>  	if (ret)
> --
> 2.43.2





[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux