Commit b21f1b18 authored by Suraj Kandpal's avatar Suraj Kandpal Committed by Zhao Yipeng
Browse files

drm/i915/hdcp: Add encoder check in intel_hdcp_get_capability

mainline inclusion
from mainline-v6.12-rc1
commit 31b42af516afa1e184d1a9f9dd4096c54044269a
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IB5KR6
CVE: CVE-2024-53051

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=31b42af516afa1e184d1a9f9dd4096c54044269a



--------------------------------

drm/i915/hdcp: Add encoder check in intel_hdcp_get_capability

Sometimes during hotplug scenario or suspend/resume scenario encoder is
not always initialized when intel_hdcp_get_capability add
a check to avoid kernel null pointer dereference.

Signed-off-by: default avatarSuraj Kandpal <suraj.kandpal@intel.com>
Reviewed-by: default avatarDnyaneshwar Bhadane <dnyaneshwar.bhadane@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240722064451.3610512-2-suraj.kandpal@intel.com


Conflicts:
    drivers/gpu/drm/i915/display/intel_hdcp.c
[The conflict is that the name of the function intel_hdcp_capable
has been changed to intel_hdcp_get_capability in the mainline commit
8e754d9e9e8a068d18cba6618e099a1f24347c98. And in order to reduce the
scope of modification, only the code changes in the function are merged.]
Signed-off-by: default avatarZhao Yipeng <zhaoyipeng5@huawei.com>
parent b54f81e4
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -142,11 +142,16 @@ int intel_hdcp_read_valid_bksv(struct intel_digital_port *dig_port,
/* Is HDCP1.4 capable on Platform and Sink */
bool intel_hdcp_capable(struct intel_connector *connector)
{
	struct intel_digital_port *dig_port = intel_attached_dig_port(connector);
	struct intel_digital_port *dig_port;
	const struct intel_hdcp_shim *shim = connector->hdcp.shim;
	bool capable = false;
	u8 bksv[5];

	if (!intel_attached_encoder(connector))
		return capable;

	dig_port = intel_attached_dig_port(connector);

	if (!shim)
		return capable;