From patchwork Thu Aug 22 04:26:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cengiz Can X-Patchwork-Id: 1975241 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 4Wq9Cc63Y1z1ydn for ; Thu, 22 Aug 2024 14:27:24 +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 1sgzPs-00064k-15; Thu, 22 Aug 2024 04:27:20 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1sgzPq-00062V-6L for kernel-team@lists.ubuntu.com; Thu, 22 Aug 2024 04:27:18 +0000 Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (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-1.canonical.com (Postfix) with ESMTPS id 57EAE3F626 for ; Thu, 22 Aug 2024 04:27:17 +0000 (UTC) Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-a7a9c275447so43203766b.3 for ; Wed, 21 Aug 2024 21:27:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724300836; x=1724905636; 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=ssIOjuc2Scit4gKGnfeqVnINSAVm/ivCea1sU1TTVS8=; b=pITpNVj1rfu/pnYuJOluoNUM9Y1JXcTRNxulDmQjDWnSZHI0b8X4fcW5fVTD44YZuf 17q8xiaawkUimaS8OySGMgK5zqdsjfPusUK1BBstUQYoGHy0idnhPWQqmIUAQzswz3iB jo/QRxOTeyjNdF8lRcoWYCRO+ZvmWojBYl5k+4Z4qMzytNTHjTqfU9huaKXbhTYBoDMt AK8QwPCFEUc0v4WN0X3lBueoplGqar7nv15WNs20Juk4hqvvykoB1OS4B7Fu0pPYzO/x LOTR33BYuWpIEVwrB/p7qkG1v6IvbAhRlkrFMREntpO+/0bbrreDVfTBk5C2kUsZ3XHP Gpww== X-Gm-Message-State: AOJu0YyL2zEOV1K67CWPNYlepBkt0tVaMS77/GSSFcLwSjMa7h+0dDmR x8CBvXiTYPK5TLOshpw2hb6PP99/EJMMzpcJtXJB6gfeaPc2gy3e4GfYwrHv7X2G7kRJ/P8Dd1g WvzohpfCrpgAzNg1eUT7fTDX4noyYNM0TQwTlv+5X/yBiQ7EDvO16W4LTA3phhjdZ+AuiCpoVn/ AaQNpxLKqvjCgB X-Received: by 2002:a17:907:7d8a:b0:a77:b4e3:4fca with SMTP id a640c23a62f3a-a866f148381mr318731666b.9.1724300836530; Wed, 21 Aug 2024 21:27:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG3Wo3IRKcLAng88JoSwSqea8/sWVEgiopPnuyGVcbs1JTJ5F4ieZZoyeMtDvnscASSuGXy6A== X-Received: by 2002:a17:907:7d8a:b0:a77:b4e3:4fca with SMTP id a640c23a62f3a-a866f148381mr318729366b.9.1724300835820; Wed, 21 Aug 2024 21:27:15 -0700 (PDT) Received: from localhost (uk.sesame.canonical.com. [185.125.190.60]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a868f47c584sm53273466b.157.2024.08.21.21.27.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Aug 2024 21:27:15 -0700 (PDT) From: Cengiz Can To: kernel-team@lists.ubuntu.com Subject: [SRU][N][PATCH 1/1] drm/amdgpu: Using uninitialized value *size when calling amdgpu_vce_cs_reloc Date: Thu, 22 Aug 2024 07:26:52 +0300 Message-ID: <20240822042652.4072048-4-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 (cherry picked from 88a9a467c548d0b3c7761b4fd54a68e70f9c0944) 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 59acf424a078..968ca2c84ef7 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c @@ -743,7 +743,8 @@ int amdgpu_vce_ring_parse_cs(struct amdgpu_cs_parser *p, 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 int idx; int i, r = 0;