Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: e15826bb3c2c ("drm/xe/guc: Refactor GuC debugfs initialization")
Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: George D Sworo <george.d.sworo@intel.com>
Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Link: https://patch.msgid.link/20260129182547.32899-2-daniele.ceraolospurio@intel.com
(cherry picked from commit dd8ea2f2ab71b98887fdc426b0651dbb1d1ea760)
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>

authored by

Daniele Ceraolo Spurio and committed by
Thomas Hellström
4cb1b327 bb36170d

+5 -3
+4 -2
drivers/gpu/drm/xe/xe_guc.c
··· 1618 1618 return xe_guc_submit_start(guc); 1619 1619 } 1620 1620 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) 1622 1622 { 1623 1623 struct xe_gt *gt = guc_to_gt(guc); 1624 1624 unsigned int fw_ref; ··· 1630 1630 if (!IS_SRIOV_VF(gt_to_xe(gt))) { 1631 1631 fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT); 1632 1632 if (!fw_ref) 1633 - return; 1633 + return -EIO; 1634 1634 1635 1635 status = xe_mmio_read32(&gt->mmio, GUC_STATUS); 1636 1636 ··· 1658 1658 1659 1659 drm_puts(p, "\n"); 1660 1660 xe_guc_submit_print(guc, p); 1661 + 1662 + return 0; 1661 1663 } 1662 1664 1663 1665 /**
+1 -1
drivers/gpu/drm/xe/xe_guc.h
··· 45 45 int xe_guc_self_cfg64(struct xe_guc *guc, u16 key, u64 val); 46 46 void xe_guc_irq_handler(struct xe_guc *guc, const u16 iir); 47 47 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); 49 49 int xe_guc_reset_prepare(struct xe_guc *guc); 50 50 void xe_guc_reset_wait(struct xe_guc *guc); 51 51 void xe_guc_stop_prepare(struct xe_guc *guc);