From: Suraj Kandpal <suraj.kandpal(a)intel.com>
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/?…
--------------------------------
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: Suraj Kandpal <suraj.kandpal(a)intel.com>
Reviewed-by: Dnyaneshwar Bhadane <dnyaneshwar.bhadane(a)intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240722064451.3610512-2-sura…
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: Zhao Yipeng <zhaoyipeng5(a)huawei.com>
---
drivers/gpu/drm/i915/display/intel_hdcp.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c b/drivers/gpu/drm/i915/display/intel_hdcp.c
index cb99839afcd0..aa4c06b15190 100644
--- a/drivers/gpu/drm/i915/display/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/display/intel_hdcp.c
@@ -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;
--
2.34.1