FAILED: patch "[PATCH] drm/amd/display: Use krealloc_array() in dal_vector_reserve()" failed to apply to 5.10-stable tree
[email protected]
maintainerThe patch below does not apply to the 5.10-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-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x da48bc4461b8a5ebfb9264c9b191a701d8e99009
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026061531-reattach-unlatch-3025@gregkh' --subject-prefix 'PATCH 5.10.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From da48bc4461b8a5ebfb9264c9b191a701d8e99009 Mon Sep 17 00:00:00 2001
From: Harry Wentland <[email protected]>
Date: Tue, 5 May 2026 11:52:15 -0400
Subject: [PATCH] drm/amd/display: Use krealloc_array() in dal_vector_reserve()
[Why & How]dal_vector_reserve() computes the allocation size as "capacity * vector->struct_size" using uint32_t arithmetic, which can silently wrap to a small value on overflow. This would cause krealloc to return a smaller buffer than expected, leading to heap overflows on subsequent vector appends.
Replace krealloc() with krealloc_array() which performs an internal overflow check and returns NULL on wrap, preventing the issue.
drivers/gpu/drm/amd/display/dc/basics/vector.c +2 -2
@@ -289,8 +289,8 @@ bool dal_vector_reserve(struct vector *vector, uint32_t capacity)if (capacity <= vector->capacity)return true; - new_container =krealloc (vector->container, - capacity * vector->struct_size,GFP_KERNEL ); + new_container =krealloc_array (vector->container, + capacity, vector->struct_size,GFP_KERNEL );if (new_container) { vector->container = new_container;
Sasha Levin
maintainerPATCH 1/1 drm/amd/display: Use krealloc_array() in dal_vector_reserve()
From: Harry Wentland <[email protected]>
[ Upstream commit da48bc4461b8a5ebfb9264c9b191a701d8e99009 ]
[Why & How]dal_vector_reserve() computes the allocation size as "capacity * vector->struct_size" using uint32_t arithmetic, which can silently wrap to a small value on overflow. This would cause krealloc to return a smaller buffer than expected, leading to heap overflows on subsequent vector appends.
Replace krealloc() with krealloc_array() which performs an internal overflow check and returns NULL on wrap, preventing the issue.
--- drivers/gpu/drm/amd/display/dc/basics/vector.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/basics/vector.c +1 -1
@@ -292,7 +292,7 @@ bool dal_vector_reserve(struct vector *vector, uint32_t capacity)return true; new_container =krealloc (vector->container, - capacity * vector->struct_size,GFP_KERNEL ); +array_size (capacity, vector->struct_size),GFP_KERNEL );if (new_container) { vector->container = new_container;
Signature · 1 line
2.53.0