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 987453FF1DD; Fri, 15 May 2026 15:56:25 +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=1778860585; cv=none; b=VYZFq1wOEq9ziV+O6hNWybC1LQUpwiKdU26JxBrzKH0ik62oPvIOoXpKBZ7ONGu2T9TVrf1nYM+pdHGi8o70CZ6IhPp72wWb80B6vEQD8vTy2NJVVxe3NfjtlodcAQV0S0XqN2WB5V0OkY2jEtP2MKpZnhC9nLlR57riCyImf3s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778860585; c=relaxed/simple; bh=2nwN4ulS/kpKI+eAV3sqRd+fCETK43WKuLte86ntFiM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QhkmJap4dfMeQ7PHHjPT2t+uDw6o3zKKqNyZUet6G8GMCPBtS9tWVucSLirt6iukhc/3blqUpNlyur+UTvI+gyfpFwOCZudnjjkMYJ+CgJQnI6fFM4F1Wch3lDiUPCW6EE4TH2PHcEhmVoRJQtWJ/Fy0ZJdVZRKEepOTuot6ZMg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=q7tnYeNv; 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="q7tnYeNv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26D8AC2BCB0; Fri, 15 May 2026 15:56:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1778860585; bh=2nwN4ulS/kpKI+eAV3sqRd+fCETK43WKuLte86ntFiM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q7tnYeNvidWGYDBonHU0GIUzPR2jtREw3+Zilqc+sjby8aPxD5RAG7SrV3BNHUj0/ O+6tqgASUTrZVI3EtSozgQyb2QWk+aKniu6gqcJwRaSKm93OVuD00TXRpbnHvsKNXr +euaX1ziMyXwDeklJqz5aOMrNAmBRe3hzZrV5E74= 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.12 144/144] drm/amdgpu/vcn4: Avoid overflow on msg bound check Date: Fri, 15 May 2026 17:49:30 +0200 Message-ID: <20260515154656.866391569@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260515154653.469907118@linuxfoundation.org> References: <20260515154653.469907118@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-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 @@ -1830,6 +1830,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; @@ -1837,7 +1838,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;