FAILED: patch "[PATCH] drm/xe/guc: Fix buffer overflow in steered register list" failed to apply to 6.18-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.18-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.18.y
git checkout FETCH_HEAD
git cherry-pick -x 632ecc90e1ca5d3b6822bb4d08f84a175b6c42c0
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026072944-swivel-tidy-c727@gregkh' --subject-prefix 'PATCH 6.18.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 632ecc90e1ca5d3b6822bb4d08f84a175b6c42c0 Mon Sep 17 00:00:00 2001
From: Tejas Upadhyay <[email protected]>
Date: Fri, 12 Jun 2026 12:34:02 +0530
Subject: [PATCH] drm/xe/guc: Fix buffer overflow in steered register list
allocation
The size calculation for the steered register extarray uses only the geometry DSS mask (g_dss_mask) to determine the number of entries to allocate:
total = bitmap_weight(gt->fuse_topo.g_dss_mask, ...) * steer_reg_num;
However, the filling loop uses for_each_dss_steering(), which iterates over for_each_dss(), defined as the union of g_dss_mask and c_dss_mask (geometry + compute DSS). On platforms with compute-only DSS bits, the loop writes past the allocated buffer, corrupting adjacent slab objects.
This manifests as list_del corruption and SLUB redzone overwrites during drm_managed_release on device unbind, since the overflow corrupts the drmres list_head of neighboring allocations.
Fix by computing the allocation size using the union of both DSS masks, matching the iteration pattern of for_each_dss_steering().
--
v2:
- use bitmap_weighted_or() (Zhanjun)
drivers/gpu/drm/xe/xe_guc_capture.c +8 -2
@@ -461,8 +461,14 @@ static void guc_capture_alloc_steered_lists(struct xe_guc *guc)if (!list || guc->capture->extlists)return ; - total =bitmap_weight (gt->fuse_topo.g_dss_mask,sizeof (gt->fuse_topo.g_dss_mask) *8 ) * -guc_capture_get_steer_reg_num (guc_to_xe (guc)); + { +xe_dss_mask_t all_dss; + + total =bitmap_weighted_or (all_dss, gt->fuse_topo.g_dss_mask, + gt->fuse_topo.c_dss_mask, +XE_MAX_DSS_FUSE_BITS ) * +guc_capture_get_steer_reg_num (guc_to_xe (guc)); + }if (!total)return ;
Sasha Levin
maintainerPATCH 1/1 drm/xe/guc: Fix buffer overflow in steered register list allocation
From: Tejas Upadhyay <[email protected]>
[ Upstream commit 632ecc90e1ca5d3b6822bb4d08f84a175b6c42c0 ]
The size calculation for the steered register extarray uses only the geometry DSS mask (g_dss_mask) to determine the number of entries to allocate:
total = bitmap_weight(gt->fuse_topo.g_dss_mask, ...) * steer_reg_num;
However, the filling loop uses for_each_dss_steering(), which iterates over for_each_dss(), defined as the union of g_dss_mask and c_dss_mask (geometry + compute DSS). On platforms with compute-only DSS bits, the loop writes past the allocated buffer, corrupting adjacent slab objects.
This manifests as list_del corruption and SLUB redzone overwrites during drm_managed_release on device unbind, since the overflow corrupts the drmres list_head of neighboring allocations.
Fix by computing the allocation size using the union of both DSS masks, matching the iteration pattern of for_each_dss_steering().
--
v2:
- use bitmap_weighted_or() (Zhanjun)
--- drivers/gpu/drm/xe/xe_guc_capture.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/xe_guc_capture.c +9 -2
@@ -437,8 +437,15 @@ static void guc_capture_alloc_steered_lists(struct xe_guc *guc)if (!list || guc->capture->extlists)return ; - total =bitmap_weight (gt->fuse_topo.g_dss_mask,sizeof (gt->fuse_topo.g_dss_mask) *8 ) * -guc_capture_get_steer_reg_num (guc_to_xe (guc)); + { +xe_dss_mask_t all_dss; + +bitmap_or (all_dss, gt->fuse_topo.g_dss_mask, gt->fuse_topo.c_dss_mask, +XE_MAX_DSS_FUSE_BITS ); + + total =bitmap_weight (all_dss,XE_MAX_DSS_FUSE_BITS ) * +guc_capture_get_steer_reg_num (guc_to_xe (guc)); + }if (!total)return ;
Signature · 1 line
2.53.0