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 8611C305668; Fri, 15 May 2026 15:56:20 +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=1778860580; cv=none; b=ffTal3q5ONwOsTgSkVzmcvCwAI86bMglis9NODOC3Ob5zE9HTIty8lLlNRVNPVScOOJs1qOp+FeouJGcD5JkqSAOVO0Pu1gtJUQXtURQ2gfCBd/WbXY6Mwr5JG/lkKwTA6QdACGVc+DtH01EtiWtPA9APbmwCYX+OBt26odz5zI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778860580; c=relaxed/simple; bh=z8wby5JyVDp3+AzA4SF6ifDjTcC0cVIZ0eIHHJipcYA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WO5QoCFkU8UDjtxhbZDRjR0i0RPM6O/9SwpnqqaBSexLPZVTWPrtcioiAA6Z4im+x/n6QXhSVsSmOd3n9nDeW8T/Y6KwA/0iqGpfcBF3hTw4fR+MtppT+1TWs3TdgDGKf5FrATj/xY5K9d5BMjOVt5Ir9S5YdhuM+Nt6BAlRAG4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=H2z4Df/m; 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="H2z4Df/m" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BDF8C2BCB0; Fri, 15 May 2026 15:56:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1778860580; bh=z8wby5JyVDp3+AzA4SF6ifDjTcC0cVIZ0eIHHJipcYA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H2z4Df/m4wXhrLScgPIdFc4ot8FIlOEAWXDrqPUaeJwX390VeZishbYB6cerxnPaT Jrc+QbhAGYHxklpzq0JQEmkr9/cTSyOttbLcSxHhJ+JgokNroDxcHLT6zo4okrBaIJ qdVCV/sMvnI7g8P8x256pv9eFx1QHsCpG1ZpdDyI= 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 143/144] drm/amdgpu/vcn3: Avoid overflow on msg bound check Date: Fri, 15 May 2026 17:49:29 +0200 Message-ID: <20260515154656.843693029@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 e6e9faba8100628990cccd13f0f044a648c303cf upstream. As pointed out by SDL, the previous condition may be vulnerable to overflow. Fixes: b193019860d6 ("drm/amdgpu/vcn3: 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 db00257ac9e4a51eb2515aaea161a019f7125e10) Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c @@ -1906,6 +1906,7 @@ static int vcn_v3_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; @@ -1913,7 +1914,8 @@ static int vcn_v3_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;