]> www.infradead.org Git - users/jedix/linux-maple.git/commit
drm/xe/guc: Fix out-of-bound while enabling engine activity stats
authorMichal Wajdeczko <michal.wajdeczko@intel.com>
Mon, 14 Apr 2025 20:23:46 +0000 (22:23 +0200)
committerMichal Wajdeczko <michal.wajdeczko@intel.com>
Thu, 17 Apr 2025 19:57:18 +0000 (21:57 +0200)
commit8f9d815a89f5d08566c52ae1d18f05fe976b2c59
tree9ace2c2d15ab85145ff884d32299388658c2ff31
parentba1f62a0cac84757ca35f4217e3cd3a2654233ae
drm/xe/guc: Fix out-of-bound while enabling engine activity stats

In the PF mode we allocate array of struct engine_activity_group
that holds activity data split for the PF and all potential VFs.
But while preparing data for use by VFs we ended with bad index.

 [ ] BUG: KASAN: slab-out-of-bounds in xe_guc_engine_activity_function_stats+0x41e/0x4f0 [xe]
 [ ] Call Trace:
 [ ]  <TASK>
 [ ]  dump_stack_lvl+0x91/0xf0
 [ ]  print_report+0xd1/0x680
 [ ]  ? __virt_addr_valid+0x23a/0x440
 [ ]  ? kasan_addr_to_slab+0xd/0xb0
 [ ]  kasan_report+0xe7/0x130
 [ ]  ? xe_guc_engine_activity_function_stats+0x41e/0x4f0 [xe]
 [ ]  ? xe_guc_engine_activity_function_stats+0x41e/0x4f0 [xe]
 [ ]  __asan_report_store8_noabort+0x17/0x30
 [ ]  xe_guc_engine_activity_function_stats+0x41e/0x4f0 [xe]
 [ ]  pf_engine_activity_stats+0x1b6/0x7f0 [xe]
 [ ]  ? kobject_put+0x5f/0x470
 [ ]  xe_pci_sriov_configure+0x28c9/0x3270 [xe]
 [ ]  ? __pfx_dev_attr_store+0x10/0x10
 [ ]  ? kstrtoull+0x3b/0x70
 [ ]  ? __pfx___lock_acquire+0x10/0x10
 [ ]  ? kstrtou16+0x65/0xf0
 [ ]  sriov_numvfs_store+0x20c/0x400
 [ ]  ? __pfx_sriov_numvfs_store+0x10/0x10
 [ ]  ? __pfx__copy_from_iter+0x10/0x10
 [ ]  ? __pfx_dev_attr_store+0x10/0x10
 [ ]  dev_attr_store+0x3b/0x80
 [ ]  ? sysfs_file_ops+0x135/0x190

Fixes: 2de3f38fbf89 ("drm/xe: Add support for per-function engine activity")
Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Cc: Riana Tauro <riana.tauro@intel.com>
Reviewed-by: Riana Tauro <riana.tauro@intel.com>
Link: https://lore.kernel.org/r/20250414202347.1909-1-michal.wajdeczko@intel.com
drivers/gpu/drm/xe/xe_guc_engine_activity.c