From patchwork Wed Oct 9 17:23:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bethany Jamison X-Patchwork-Id: 1995021 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 4XP08y59Jvz1xsq for ; Thu, 10 Oct 2024 04:23:30 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1syaPD-0003CW-Iq; Wed, 09 Oct 2024 17:23:23 +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 1syaPB-0003CF-Fn for kernel-team@lists.ubuntu.com; Wed, 09 Oct 2024 17:23:21 +0000 Received: from mail-io1-f72.google.com (mail-io1-f72.google.com [209.85.166.72]) (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 035AE3F1F4 for ; Wed, 9 Oct 2024 17:23:21 +0000 (UTC) Received: by mail-io1-f72.google.com with SMTP id ca18e2360f4ac-83547df1194so358239f.3 for ; Wed, 09 Oct 2024 10:23:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728494600; x=1729099400; 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=/8r6uxwC4eka7PjmTqSVyCjWBXc+7U6BJzmQkez3Ty8=; b=IUeBc9ECSJEZAHQ0zXMRR2xCkR2JAnmv393SEVHab0nYGHsjnq05VvftstUVgXyTRJ J8ZJhE/jaYK2ZBT3r9Vocyus6hzhkytf/uq2es0VpGp9G5n4237yWHnh7qRuAtATo2ke Yq0U6vFhXiwwdtpc4tXFuT5esKBGd5lQmKMV/1C48vwPJg66UXnXYjxX1UlinJjr1g2A ajIU7oMSteHwmlqZUbs5oqbFWVglxQFY2QC3LPbUdTxT5wX5QrBp8B6IWFnaw75Q5rpf IzTqo5Xnsyl1n0W08FXkx3oLHlV6PRfvTrbxRon0UASdbPVu44tjoR+M7cmU7f1k5Yx0 sk5w== X-Gm-Message-State: AOJu0Yy9vvjlI29cJzHR6KvGKBhn5uDfVAr5dLM98yplOwF0Dw+gONfb lHrBaJ3HmUw/TkCV31NhuRMvptWnhBKPwrtpm7crfMxfxI6f2pqaXPIWKg8+CbXc2wyQG5YHyIM vo0iByFjxL1epsR/FsznsRqPH4Kd5MoK6dWS2kjjNpsshlETPnCaLuE5pKPCfsPfoaGETErp248 Gu52p4oZliBA== X-Received: by 2002:a05:6e02:1a26:b0:3a0:9c8e:9647 with SMTP id e9e14a558f8ab-3a397cdc346mr9583175ab.1.1728494598810; Wed, 09 Oct 2024 10:23:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF39I+X8rjcGa5jbAp54/uyY+2H9oWyYcjrUUPWBw9drW60CdTX6ALBQSKw5PTlQmEfnkdoBA== X-Received: by 2002:a05:6e02:1a26:b0:3a0:9c8e:9647 with SMTP id e9e14a558f8ab-3a397cdc346mr9583015ab.1.1728494597694; Wed, 09 Oct 2024 10:23:17 -0700 (PDT) Received: from smtp.gmail.com (167-248-51-36.oa02.lnk04.ne.dynamic.allophone.net. [167.248.51.36]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4db90af1a9asm1086887173.164.2024.10.09.10.23.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2024 10:23:17 -0700 (PDT) From: Bethany Jamison To: kernel-team@lists.ubuntu.com Subject: [SRU][N][PATCH 1/1] drm/amdgpu: fix ucode out-of-bounds read warning Date: Wed, 9 Oct 2024 12:23:16 -0500 Message-Id: <20241009172316.18055-2-bethany.jamison@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241009172316.18055-1-bethany.jamison@canonical.com> References: <20241009172316.18055-1-bethany.jamison@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: Tim Huang [ Upstream commit 8944acd0f9db33e17f387fdc75d33bb473d7936f ] Clear warning that read ucode[] may out-of-bounds. Signed-off-by: Tim Huang Reviewed-by: Alex Deucher Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin (cherry picked from commit 23fefef859c6057e6770584242bdd938254f8ddd linux-6.10.y) CVE-2024-46723 Signed-off-by: Bethany Jamison --- drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c index b8280be6225d9..c3d89088123db 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c @@ -213,6 +213,9 @@ static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device, struct amdgpu_firmware_info *ucode; id = fw_type_convert(cgs_device, type); + if (id >= AMDGPU_UCODE_ID_MAXIMUM) + return -EINVAL; + ucode = &adev->firmware.ucode[id]; if (ucode->fw == NULL) return -EINVAL;