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

drm/xe/pf: Drop GuC notifications for non-existing VF

It is unlikely that GuC will ever send a G2H notification with an
invalid VFID and it is currently harmless if that actually happen.
But in upcoming patches we will start using that VFID as an index
and we must be sure it is a valid to avoid a crash due to a buggy
firmware or a currupted G2H message.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: Piotr Piórkowski <piotr.piorkowski@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240828210809.1528-4-michal.wajdeczko@intel.com

+6
+6
drivers/gpu/drm/xe/xe_gt_sriov_pf_control.c
··· 8 8 #include "xe_device.h" 9 9 #include "xe_gt.h" 10 10 #include "xe_gt_sriov_pf_control.h" 11 + #include "xe_gt_sriov_pf_helpers.h" 11 12 #include "xe_gt_sriov_printk.h" 12 13 #include "xe_guc_ct.h" 13 14 #include "xe_sriov.h" ··· 213 212 214 213 static int pf_handle_vf_event(struct xe_gt *gt, u32 vfid, u32 eventid) 215 214 { 215 + xe_gt_sriov_dbg_verbose(gt, "received VF%u event %#x\n", vfid, eventid); 216 + 217 + if (vfid > xe_gt_sriov_pf_get_totalvfs(gt)) 218 + return -EPROTO; 219 + 216 220 switch (eventid) { 217 221 case GUC_PF_NOTIFY_VF_FLR: 218 222 pf_handle_vf_flr(gt, vfid);