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 1284E1487CD; Thu, 12 Dec 2024 15:17:57 +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=1734016677; cv=none; b=MhB9OS+0E9JcBxr/PuKXSeFuNIt86B3Qc3DvKp6F4Gy56QhS7KlgOriTbO86j9nwUDwwtePcNZ+IIHuAi5xCorHdzrcEZu4e5gxriQFpstum1owlm5jq7Nb5gLeOUplrGcOR7DAJvqIVYQKBHGrwKjiZzRtC/KeCBpUK+b8XuDA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734016677; c=relaxed/simple; bh=AEJEbY1GEzR7zIACpBwOIyoFlikYDKI5DQBqTQ/88QU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MU69/Y0tKFF31dc971xKO2NqKaohO5gWTOvh2hAU4sNiQnjY/j4e5Nvzf9OrdOj0Jc/X0afljFWdrGy3dLIZWsVmeLvq0cOziUo/EEBOjswwyzu5/MCyEneHLi/9axuaum/fjKloZE/zwkJU7QllHSzSEUizqMnQRmcyWM3/QuQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=BQE1N5tb; 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="BQE1N5tb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B8D4C4CECE; Thu, 12 Dec 2024 15:17:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1734016676; bh=AEJEbY1GEzR7zIACpBwOIyoFlikYDKI5DQBqTQ/88QU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BQE1N5tbU8j0McXNfJCdLTUvSlbQAddkjlPBYrOkaWBV9sltVDr9qmgqYc5Guyg35 ANzLT6u09jrL86PRMXtSkKs04emv34WHVnpRtqRlgoNY41ALlUcZuPoreWywat6AAD LuBHvKWc1TzRno98Hi48lUIrVhJp4ilcrNeTAHIo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Igor Artemiev , Alex Deucher , Sasha Levin Subject: [PATCH 6.12 267/466] drm/radeon/r600_cs: Fix possible int overflow in r600_packet3_check() Date: Thu, 12 Dec 2024 15:57:16 +0100 Message-ID: <20241212144317.340866736@linuxfoundation.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241212144306.641051666@linuxfoundation.org> References: <20241212144306.641051666@linuxfoundation.org> User-Agent: quilt/0.67 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: Igor Artemiev [ Upstream commit a1e2da6a5072f8abe5b0feaa91a5bcd9dc544a04 ] It is possible, although unlikely, that an integer overflow will occur when the result of radeon_get_ib_value() is shifted to the left. Avoid it by casting one of the operands to larger data type (u64). Found by Linux Verification Center (linuxtesting.org) with static analysis tool SVACE. Signed-off-by: Igor Artemiev Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/radeon/r600_cs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c index 1b2d31c4d77ca..ac77d1246b945 100644 --- a/drivers/gpu/drm/radeon/r600_cs.c +++ b/drivers/gpu/drm/radeon/r600_cs.c @@ -2104,7 +2104,7 @@ static int r600_packet3_check(struct radeon_cs_parser *p, return -EINVAL; } - offset = radeon_get_ib_value(p, idx+1) << 8; + offset = (u64)radeon_get_ib_value(p, idx+1) << 8; if (offset != track->vgt_strmout_bo_offset[idx_value]) { DRM_ERROR("bad STRMOUT_BASE_UPDATE, bo offset does not match: 0x%llx, 0x%x\n", offset, track->vgt_strmout_bo_offset[idx_value]); -- 2.43.0