Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] drm/xe/hdcp: Add NULL check for media_gt in intel_hdcp_gsc_check_status()
@ 2026-04-16 18:17 Gustavo Sousa
  2026-04-16 18:42 ` ✓ CI.KUnit: success for drm/xe/hdcp: Add NULL check for media_gt in intel_hdcp_gsc_check_status() (rev2) Patchwork
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Gustavo Sousa @ 2026-04-16 18:17 UTC (permalink / raw)
  To: intel-xe; +Cc: Shuicheng Lin, Gustavo Sousa

When media GT is disabled via configfs, there is no allocation for
media_gt, which is kept as NULL.  In such scenario,
intel_hdcp_gsc_check_status() results in a kernel pagefault error due to
&gt->uc.gsc being evaluated as an invalid memory address.

Fix that by introducing a NULL check on media_gt and bailing out early
if so.

While at it, also drop the NULL check for gsc, since it can't be NULL if
media_gt is not NULL.

v2:
  - Get address for gsc only after checking that gt is not NULL.
    (Shuicheng)
  - Drop the NULL check for gsc. (Shuicheng)

Cc: Shuicheng Lin <shuicheng.lin@intel.com>
Signed-off-by: Gustavo Sousa <gustavo.sousa@intel.com>
---
Changes in v2:
- EDITME: describe what is new in this series revision.
- EDITME: use bulletpoints and terse descriptions.
- Link to v1: https://patch.msgid.link/20260302-check-for-null-media_gt-in-intel_hdcp_gsc_check_status-v1-1-163d5f826b30@intel.com
---
 drivers/gpu/drm/xe/display/xe_hdcp_gsc.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c b/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c
index 29c72aa4b0d2..33494b86205d 100644
--- a/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c
+++ b/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c
@@ -37,9 +37,17 @@ static bool intel_hdcp_gsc_check_status(struct drm_device *drm)
 	struct xe_device *xe = to_xe_device(drm);
 	struct xe_tile *tile = xe_device_get_root_tile(xe);
 	struct xe_gt *gt = tile->media_gt;
-	struct xe_gsc *gsc = &gt->uc.gsc;
+	struct xe_gsc *gsc;
+
+	if (!gt) {
+		drm_dbg_kms(&xe->drm,
+			    "not checking GSC status for HDCP2.x: media GT not present or disabled\n");
+		return false;
+	}
+
+	gsc = &gt->uc.gsc;
 
-	if (!gsc || !xe_uc_fw_is_available(&gsc->fw)) {
+	if (!xe_uc_fw_is_available(&gsc->fw)) {
 		drm_dbg_kms(&xe->drm,
 			    "GSC Components not ready for HDCP2.x\n");
 		return false;

---
base-commit: 9ac7dca8d82a4e6d9806ac6c991f0777338833bb
change-id: 20260302-check-for-null-media_gt-in-intel_hdcp_gsc_check_status-071898b8a402

Best regards,
--  
Gustavo Sousa <gustavo.sousa@intel.com>


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-04-29 18:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-16 18:17 [PATCH v2] drm/xe/hdcp: Add NULL check for media_gt in intel_hdcp_gsc_check_status() Gustavo Sousa
2026-04-16 18:42 ` ✓ CI.KUnit: success for drm/xe/hdcp: Add NULL check for media_gt in intel_hdcp_gsc_check_status() (rev2) Patchwork
2026-04-16 19:37 ` [PATCH v2] drm/xe/hdcp: Add NULL check for media_gt in intel_hdcp_gsc_check_status() Matt Roper
2026-04-17  2:20   ` Lin, Shuicheng
2026-04-29 15:09     ` Gustavo Sousa
2026-04-29 18:27       ` Gustavo Sousa
2026-04-16 20:13 ` ✓ Xe.CI.BAT: success for drm/xe/hdcp: Add NULL check for media_gt in intel_hdcp_gsc_check_status() (rev2) Patchwork
2026-04-16 21:58 ` ✗ Xe.CI.FULL: failure " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox