Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 7ADA73BCD3B; Thu, 20 Aug 2026 15:25:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787239560; cv=none; b=o34xQkkdQADOeT/FNldgRZtP0UYrquLZ7rsg7n7UL+2kK45/pVJNZClwfJEHeH3RK6fQxIqwc7US1K+EZJSRW6XeZEpjtLtpiyeyl7EpsfJ2YPLDTw9EXnZTJ16byxpIAIi5PpRA9LvnfJ9TbhjG+DWOB1MS1+sGHZtfF2SRarw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787239560; c=relaxed/simple; bh=EYu0c2UZCemztQG/bECDXVkC0DSoH3RZCr8uYxcBCtY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DjpxEU4XqC5NxbA7vPY99GoEzVYGEeZGiy6wbV+kuErYdPve8muw+u4bolZBZM4i4fsqiOapXMljVOwQqCjCdNviinFf5lJydwbYRi+cdaiRL7DRYlniQf7XuDrAGnqR+oZHnGuOeYkICCdkhXv2Vp9PDte7vreoiIh137PJDtE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=CljAxtbQ; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="CljAxtbQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC2C81F000E9; Thu, 20 Aug 2026 15:25:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1787239559; bh=iObmfzzZyG7oYtvMRaA3UHDYla55YV2FQz6ICRq9eoM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=CljAxtbQH/4OEwkTVXKuvh1R7IrxqlaggnEu93lffg4PMX+wm+1tjkXSGCMpVZZhf 3cvGrdiPLvFHR/msWRFYCv4DRokvDJWolicpdwD5OGur3ZAJu5y50fGsnjUz+AQ8E+ Gju3m0n6MobknrcDG1DE+WhuUYM+jIKkXiV41GG8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, David Rosca , Leo Liu , Ruijing Dong , Alex Deucher Subject: [PATCH 6.12 090/220] drm/amdgpu: Fix UVD decode image min size calculation Date: Thu, 20 Aug 2026 16:54:40 +0200 Message-ID: <20260820145226.184755592@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260820145223.480031205@linuxfoundation.org> References: <20260820145223.480031205@linuxfoundation.org> User-Agent: quilt/0.69 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-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: David Rosca commit b8bb9ba3f101a1b0011f785a577a4a0a38371174 upstream. This needs to use pitch instead of width. Also reject pitch over 4096 to avoid overflow. Signed-off-by: David Rosca Acked-by: Leo Liu Reviewed-by: Ruijing Dong Signed-off-by: Alex Deucher (cherry picked from commit b41c8cb12e202b220353332ab87dc01a11f69304) Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c @@ -761,7 +761,7 @@ static int amdgpu_uvd_cs_msg_decode(stru return -EINVAL; } - if (width > pitch) { + if (width > pitch || pitch > 4096) { DRM_ERROR("Invalid UVD decoding target pitch!\n"); return -EINVAL; } @@ -773,7 +773,7 @@ static int amdgpu_uvd_cs_msg_decode(stru } buf_sizes[0x1] = dpb_size; - buf_sizes[0x2] = image_size; + buf_sizes[0x2] = (pitch * height) * 3 / 2; buf_sizes[0x4] = min_ctx_size; /* store image width to adjust nb memory pstate */ adev->uvd.decode_image_width = width;