From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 DDEB93BB116; Fri, 15 May 2026 16:17:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778861821; cv=none; b=t4aUvLoAxbpA7g+MQkuuaP+bPgHIxbIcLTX81+fgtVEhdUXcEU/T6vghf67ibtxGHy6k8zqqPlsU7shxdYWVzrR0Rq7G8tRNCat+LHnwQaQno0oB4Ffig7Zv8gTpDyMY7Q14auZJamXlEWFOk+yQbbPndYvx8Uy1Kdq15hXP89Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778861821; c=relaxed/simple; bh=moxDJBW1cbZn7f1F6z7lC0I5pFNcc/NPfbc2Ynp7nUk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VX3J29L2w6eM+lcbX4tLmZ5Cd9sJeQgCWSZHj4c9BmWhmqccPRKSW+/ncDh94O+5dqK2wYApC+1OeMnspvz7RFqMkUlk72tXmzFTCxLroA6nknQJSlFMLE8BM5Hpr6L+KwSZQ1ssKya4BRElPDMdXTnRV1m6Omyczdrtr0gS+OY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=2aw7zeKw; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="2aw7zeKw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72637C2BCB0; Fri, 15 May 2026 16:17:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1778861821; bh=moxDJBW1cbZn7f1F6z7lC0I5pFNcc/NPfbc2Ynp7nUk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2aw7zeKwoP70RTLzb/CA9ctcEJcknCiVUCpTMkrOohFhx9MQwW11NUFNRFI39Bb6J F6hU8jhQ9tJe/NJfKWnKqqtWAuHqpbApFyPCO1ptp3TpnPjMpGuUB2PXQ1+YU9eOA1 Ub3/bMGeq4wsoE8OvNmm5jMnfgbOelhrJnXH3aQc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, SDL , Benjamin Cheng , Ruijing Dong , Alex Deucher Subject: [PATCH 6.6 469/474] drm/amdgpu/vcn4: Avoid overflow on msg bound check Date: Fri, 15 May 2026 17:49:38 +0200 Message-ID: <20260515154725.256625741@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260515154715.053014143@linuxfoundation.org> References: <20260515154715.053014143@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.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Benjamin Cheng commit 65bce27ea6192320448c30267ffc17ffa094e713 upstream. As pointed out by SDL, the previous condition may be vulnerable to overflow. Fixes: 0a78f2bac142 ("drm/amdgpu/vcn4: Prevent OOB reads when parsing dec msg") Cc: SDL Signed-off-by: Benjamin Cheng Reviewed-by: Ruijing Dong Signed-off-by: Alex Deucher (cherry picked from commit 3c5367d950140d4ec7af830b2268a5a6fdaa3885) Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c @@ -1731,6 +1731,7 @@ static int vcn_v4_0_dec_msg(struct amdgp for (i = 0, msg = &msg[6]; i < num_buffers; ++i, msg += 4) { uint32_t offset, size, *create; + uint64_t buf_end; if (msg[0] != RDECODE_MESSAGE_CREATE) continue; @@ -1738,7 +1739,8 @@ static int vcn_v4_0_dec_msg(struct amdgp offset = msg[1]; size = msg[2]; - if (size < 4 || offset + size > end - addr) { + if (size < 4 || check_add_overflow(offset, size, &buf_end) || + buf_end > end - addr) { DRM_ERROR("VCN message buffer exceeds BO bounds!\n"); r = -EINVAL; goto out;