From patchwork Thu Aug 22 04:26:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cengiz Can X-Patchwork-Id: 1975240 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wq9CZ5Rcwz1ydn for ; Thu, 22 Aug 2024 14:27:22 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1sgzPp-00062g-Qw; Thu, 22 Aug 2024 04:27:17 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1sgzPn-00061X-ND for kernel-team@lists.ubuntu.com; Thu, 22 Aug 2024 04:27:15 +0000 Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 2AAA33F6B5 for ; Thu, 22 Aug 2024 04:27:15 +0000 (UTC) Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-a7a8281dba5so56127966b.3 for ; Wed, 21 Aug 2024 21:27:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724300834; x=1724905634; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YEi7Afn+WgirQD8BNoA7L39vcWoVy7OlOXHm4EG0XrQ=; b=STjnZwdKjMyTfOUnOwhOba1zPUoUWQDDlt7/HjtkwPOav5gOupFFUllPDEXqS53z0s TwLYnnA/TZBY7uXpUg9R11/falvPbXVorLOJQ9cFn8m7Eu7VTNYQ1wV9WR/sFra6QX1z FWoRL+5ckxgHIvzwyenm2mh5dEqTcsD0JgZvbw3cx82yvwFr0smc+A4FA+1HbwE0x0Us sFzvj74DUJ1e5tCZyjr0MLVimnvR1e+mfa+laHVC5LP4t6PQ5bLf7KQGigIdN2FDeN7d aj5NEhhh7zRX0j17PaEDnpkG3zq3tqFJ91sy8L57ML0uArlLTXx5PXBbURIDFb2iHCo1 T38g== X-Gm-Message-State: AOJu0Yyvo+/EQsQYk6674g5LZ79GYSjZ290P/KF0PHQFTnvbCnFX0t0d HlQTAp69jC+ECpWxUrt0cEdNlkMCDPzYUqSmdPpFOZqXsIUAVMoeKvx2l4mb/njYjQs/YVo6t+Q qrcwTgEvEgjLwcf2Fz7LlR9fBYdrYFLHGXeVQhkqaIQhURDpHoxULGahsqLx3kJxkhWx4VE7kCm SMmAPkOps52h9k X-Received: by 2002:a17:907:6d17:b0:a86:7bda:d996 with SMTP id a640c23a62f3a-a867bdadbf5mr252418266b.35.1724300834327; Wed, 21 Aug 2024 21:27:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGgEFzFrGIfOFI+gDiWWDD43tQkNSwQF46iqJGp2VcTi8GJkQpdpdvPVjwZQcb/zDSFvHfVjw== X-Received: by 2002:a17:907:6d17:b0:a86:7bda:d996 with SMTP id a640c23a62f3a-a867bdadbf5mr252416066b.35.1724300833517; Wed, 21 Aug 2024 21:27:13 -0700 (PDT) Received: from localhost (uk.sesame.canonical.com. [185.125.190.60]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a868f21fef0sm54343366b.21.2024.08.21.21.27.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Aug 2024 21:27:13 -0700 (PDT) From: Cengiz Can To: kernel-team@lists.ubuntu.com Subject: [SRU][J][PATCH] drm/amdgpu: Using uninitialized value *size when calling amdgpu_vce_cs_reloc Date: Thu, 22 Aug 2024 07:26:51 +0300 Message-ID: <20240822042652.4072048-3-cengiz.can@canonical.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240822042652.4072048-1-cengiz.can@canonical.com> References: <20240822042652.4072048-1-cengiz.can@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Jesse Zhang Initialize the size before calling amdgpu_vce_cs_reloc, such as case 0x03000001. V2: To really improve the handling we would actually need to have a separate value of 0xffffffff.(Christian) Signed-off-by: Jesse Zhang Suggested-by: Christian König Reviewed-by: Christian König Signed-off-by: Alex Deucher (backported from commit 88a9a467c548d0b3c7761b4fd54a68e70f9c0944) [cengizcan: commit f10984a353c8 ("drm/amd/amdgpu: Fix errors & warnings in amdgpu _uvd, _vce.c") is missing from tree so adjust context] CVE-2024-42228 Signed-off-by: Cengiz Can --- drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c index 8e8dee9fac9f..9f7450a8d004 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c @@ -733,7 +733,8 @@ int amdgpu_vce_ring_parse_cs(struct amdgpu_cs_parser *p, uint32_t ib_idx) uint32_t created = 0; uint32_t allocated = 0; uint32_t tmp, handle = 0; - uint32_t *size = &tmp; + uint32_t dummy = 0xffffffff; + uint32_t *size = &dummy; unsigned idx; int i, r = 0;