Skip to content

Commit 4cb1b32

Browse files
dceraoloThomas Hellström
authored andcommitted
drm/xe/guc: Fix CFI violation in debugfs access.
xe_guc_print_info is void-returning, but the function pointer it is assigned to expects an int-returning function, leading to the following CFI error: [ 206.873690] CFI failure at guc_debugfs_show+0xa1/0xf0 [xe] (target: xe_guc_print_info+0x0/0x370 [xe]; expected type: 0xbe3bc66a) Fix this by updating xe_guc_print_info to return an integer. Fixes: e15826b ("drm/xe/guc: Refactor GuC debugfs initialization") Signed-off-by: Daniele Ceraolo Spurio <[email protected]> Cc: Michal Wajdeczko <[email protected]> Cc: George D Sworo <[email protected]> Reviewed-by: Michal Wajdeczko <[email protected]> Link: https://patch.msgid.link/[email protected] (cherry picked from commit dd8ea2f) Signed-off-by: Thomas Hellström <[email protected]>
1 parent bb36170 commit 4cb1b32

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

drivers/gpu/drm/xe/xe_guc.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1618,7 +1618,7 @@ int xe_guc_start(struct xe_guc *guc)
16181618
return xe_guc_submit_start(guc);
16191619
}
16201620

1621-
void xe_guc_print_info(struct xe_guc *guc, struct drm_printer *p)
1621+
int xe_guc_print_info(struct xe_guc *guc, struct drm_printer *p)
16221622
{
16231623
struct xe_gt *gt = guc_to_gt(guc);
16241624
unsigned int fw_ref;
@@ -1630,7 +1630,7 @@ void xe_guc_print_info(struct xe_guc *guc, struct drm_printer *p)
16301630
if (!IS_SRIOV_VF(gt_to_xe(gt))) {
16311631
fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
16321632
if (!fw_ref)
1633-
return;
1633+
return -EIO;
16341634

16351635
status = xe_mmio_read32(&gt->mmio, GUC_STATUS);
16361636

@@ -1658,6 +1658,8 @@ void xe_guc_print_info(struct xe_guc *guc, struct drm_printer *p)
16581658

16591659
drm_puts(p, "\n");
16601660
xe_guc_submit_print(guc, p);
1661+
1662+
return 0;
16611663
}
16621664

16631665
/**

drivers/gpu/drm/xe/xe_guc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ int xe_guc_self_cfg32(struct xe_guc *guc, u16 key, u32 val);
4545
int xe_guc_self_cfg64(struct xe_guc *guc, u16 key, u64 val);
4646
void xe_guc_irq_handler(struct xe_guc *guc, const u16 iir);
4747
void xe_guc_sanitize(struct xe_guc *guc);
48-
void xe_guc_print_info(struct xe_guc *guc, struct drm_printer *p);
48+
int xe_guc_print_info(struct xe_guc *guc, struct drm_printer *p);
4949
int xe_guc_reset_prepare(struct xe_guc *guc);
5050
void xe_guc_reset_wait(struct xe_guc *guc);
5151
void xe_guc_stop_prepare(struct xe_guc *guc);

0 commit comments

Comments
 (0)