From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C5F43D669A; Tue, 16 Jun 2026 17:46:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781631995; cv=none; b=mgWWyVn/CMZaseGy7eaubXtcPT5xhiKeYPO2ktC8yoXRvlluXbYIGuwKtsz7Xnly26iwUUGQBedBVWrN+TRmL53grCCrMcJanwwNmxvsZjGqHDEBUMRvcSfcWLvRf8dh2wnjmSO38d3+N47coQNnzwXjcZutEOnvG/qvsf2XrI8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781631995; c=relaxed/simple; bh=sLjmNT2Gi6YBLaLnQhUTA9Yiqt7t4jMWyWKuyushADc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LSQBDjdnJEhdTE8CyPOy8FpZUTyTrBnZNWdDkjq8l+Ka2mi6W90+jITBcoIN41RkR6F/qdRkkINU9lM57GNmOLHh8Ok6gk+UTtEuG+VMFvL01g+4FWLMN8qouAGErhEJm0gjRI5tEWk1BrVyXKLnKX/98YyrRCmKSFPvf7zClRY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Oxc01+jH; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Oxc01+jH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E5631F000E9; Tue, 16 Jun 2026 17:46:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1781631994; bh=A8P2IXjlRMsv+dJXBujhUTGkUuRvMypyxoaipb1qzgs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Oxc01+jH1MUYMHZmR6S3kXgfKXc3bCzQWkS1eKR/+A4cRMwAdxUWzjyAl6WNDnrfy L9UUaRpm5lHFjYStFbMgRfnA9t0/1fpnGY698Pm8N7QJP0bVxzlTgh4Smd6WPJPy+V rmAOJt40leoJ9vDTbj4rExROGUlWEtmTdi8ftXuY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Alex Hung , Harry Wentland , Ray Wu , Daniel Wheeler , Alex Deucher Subject: [PATCH 6.1 326/522] drm/amd/display: Use krealloc_array() in dal_vector_reserve() Date: Tue, 16 Jun 2026 20:27:53 +0530 Message-ID: <20260616145141.088507460@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260616145125.307082728@linuxfoundation.org> References: <20260616145125.307082728@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Harry Wentland commit da48bc4461b8a5ebfb9264c9b191a701d8e99009 upstream. [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. Fixes: 2004f45ef83f ("drm/amd/display: Use kernel alloc/free") Assisted-by: Copilot:claude-opus-4.6 Reviewed-by: Alex Hung Signed-off-by: Harry Wentland Signed-off-by: Ray Wu Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher (cherry picked from commit 37668568641ccc4cc1dbca4923d0a16609dd5707) Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/display/dc/basics/vector.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/amd/display/dc/basics/vector.c +++ b/drivers/gpu/drm/amd/display/dc/basics/vector.c @@ -289,8 +289,8 @@ bool dal_vector_reserve(struct vector *v 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;