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 65C884A0F; Thu, 13 Jun 2024 12:49:44 +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=1718282984; cv=none; b=RGqX9k6QENaU+OBodDt+avh2MORkHQd+P/d0InXsA/RiHPL5OAfZTuraHtgBa4waV3u9Z87TJDrESmojKPJcSbURHqSq/Gd+0Ee7ts66SJ8uVTsKi0lJ5A4VDh3mEXmgjuOQ+LUMDwv7TQf1INtKjz+E3RuT/2v4RHFrBm0wGDc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718282984; c=relaxed/simple; bh=eBciTZj/AVV+jqs6YHsONCkWq8M45V0Ctkm72WkVfVU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uvSI8JmYZR1BNB/hl3YdMptwizmFzPcbGpxQz9gYDIeXRb8ZvNdGNqLki8Ffs89Xe5iJl/l8lg7kXJizvzo6nvO8f6pDzZXE91ABmZTPCbDK3Y+Ss/KbBBWizicHssfnEXUUvZSL4bRG4IRMZ4SufnKwQqYTNrX9LKwsKot6gqA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ROheeUfv; 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="ROheeUfv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1258C2BBFC; Thu, 13 Jun 2024 12:49:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1718282984; bh=eBciTZj/AVV+jqs6YHsONCkWq8M45V0Ctkm72WkVfVU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ROheeUfvBccVCpqNCPZWgvjmYY/TMw/qC7thzrM+AaHzlyddLtd9bWyJesrOTv3O6 XqSFInidV9r2W+Xz4QWAFuiktLsmC/2XPxOFXI+SIuTzcR5gToKYSqko/Bb7BxELuL 8sLKcIAbmxDl0umUpHFEiLyqgwv9bT2MLyek8KRc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Bob Zhou , =?UTF-8?q?Christian=20K=C3=B6nig?= , Le Ma , Alex Deucher Subject: [PATCH 6.1 18/85] drm/amdgpu: add error handle to avoid out-of-bounds Date: Thu, 13 Jun 2024 13:35:16 +0200 Message-ID: <20240613113214.846338237@linuxfoundation.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240613113214.134806994@linuxfoundation.org> References: <20240613113214.134806994@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Bob Zhou commit 8b2faf1a4f3b6c748c0da36cda865a226534d520 upstream. if the sdma_v4_0_irq_id_to_seq return -EINVAL, the process should be stop to avoid out-of-bounds read, so directly return -EINVAL. Signed-off-by: Bob Zhou Acked-by: Christian König Reviewed-by: Le Ma Signed-off-by: Alex Deucher Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c @@ -2049,6 +2049,9 @@ static int sdma_v4_0_process_trap_irq(st DRM_DEBUG("IH: SDMA trap\n"); instance = sdma_v4_0_irq_id_to_seq(entry->client_id); + if (instance < 0) + return instance; + switch (entry->ring_id) { case 0: amdgpu_fence_process(&adev->sdma.instance[instance].ring);