summaryrefslogtreecommitdiff
path: root/rust/kernel/alloc/allocator
diff options
context:
space:
mode:
authorDavidlohr Bueso <dave@stgolabs.net>2026-11-06 15:37:11 -0800
committerDave Jiang <dave.jiang@intel.com>2026-11-16 14:47:43 -0700
commit1731c729762b54e41965a822415dd35b91570b81 (patch)
treec2de3d246de9e31feb1160444da1b64911433207 /rust/kernel/alloc/allocator
parentaebb7274476403040d582c61478df8f4a7bf9cd3 (diff)
cxl/region: Restore a target's position from its slot after sorting
Region auto-discovery records each arriving endpoint decoder in the first free @targets slot and sets cxled->pos to that slot. Once every member has arrived, cxl_region_sort_targets() calculates each one's interleave position and sorts the array by it. The original version of that function then restored cxled->pos from the member's slot in the sorted array, so that follow-on code could rely on p->targets[cxled->pos] naming the member, failed sort or not. Commit 0cf36a85c140 ("cxl/region: Use cxl_calc_interleave_pos() for auto-discovery") dropped that restore. cxled->pos now keeps whatever cxl_calc_interleave_pos() returned, which on failure is a negative errno. A member that could not be placed is left in a region it cannot be detached from by position: deleting that region runs __cxl_decoder_detach(), which finds pos < 0 and triggers: cxl region0: expected mem0:decoder3.0 at position -6 WARNING: drivers/cxl/core/region.c:2314 at __cxl_decoder_detach+0x483/0x910 A decoder committed by firmware behind a switch whose own decoders were not committed for the range is enough to get there The same stale position is what commit cbda6a2c2bec ("cxl/region: Fix out-of-bounds access in cxl_cancel_auto_attach()") had to work around by walking the array instead of indexing it. Restore cxled->pos from the member's slot after the sort. Fixes: 0cf36a85c140 ("cxl/region: Use cxl_calc_interleave_pos() for auto-discovery") Reviewed-by: Alison Schofield <alison.schofield@intel.com> Signed-off-by: Davidlohr Bueso <dave@stgolabs.net> Reviewed-by: Ben Cheatham <benjamin.cheatham@amd.com> Reviewed-by: Li Ming <ming.li@zohomail.com> Link: https://patch.msgid.link/20261106233711.2654827-1-dave@stgolabs.net Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Diffstat (limited to 'rust/kernel/alloc/allocator')
0 files changed, 0 insertions, 0 deletions