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 C7D9F480DF8 for ; Wed, 29 Jul 2026 13:02:37 +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=1785330159; cv=none; b=eOwfR0vtvI47JLr860d7noIdkbiuO7rVLlCIrSYWzcYdg8b1CkenBxi7FsqBr6/o+eWuEmB1L43ltzgrrRlWt1tDgcr3gxntxYWLg/YBUB+RVHMqvKdCdp8DtQ6Ijk3XmmVotcZwc5LyQfG277PbP7WYpfFhmxsRMukhqKKk7f0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785330159; c=relaxed/simple; bh=QM6y1b7J45fksis66Y/Lb50vAOMZTrjUd5YDVvvsIUA=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=URTtP7F+GA+/tadvi9EBHUkp23InISyc5IBh7bAMNz6m4yN6axaJxIrEEzpMUY27ci051pZXnNZ/AyGs5/rYRLlI1u3vooaxY9XDgz/2bUUaktXWDTQYsVA/YDJY/kKMfVc6uyPpLCv4ZN5P1XIi5WK+XP4Mztpje6mdY4DiYOk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=haIpzDQl; 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="haIpzDQl" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD03D1F000E9; Wed, 29 Jul 2026 13:02:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1785330157; bh=Vzk0OEaOfywz8mkpvhxxTctBozIwEChwZzUOBIEMggE=; h=Subject:To:Cc:From:Date; b=haIpzDQlxmdfJqgIAO/ZOjA4CS4pdMdXZPToctkfJnCy5GNvl8qMmBrXndtw+GFqQ 3LJrhr9CTlfBJ1raU1pMg8etjaZUg8L2Hs5mnSDLDTkt1tawzgiK1N7MW3Vg2MCYKq wz6wAdrdkrKZnek+2RPHNW1K3+ILhZ2693arob+o= Subject: FAILED: patch "[PATCH] media: v4l2-ctrls: validate HEVC active reference counts" failed to apply to 5.10-stable tree To: pengpeng@iscas.ac.cn,hverkuil+cisco@kernel.org,nicolas.dufresne@collabora.com Cc: From: Date: Wed, 29 Jul 2026 15:02:16 +0200 Message-ID: <2026072916-driller-shed-862c@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 5.10-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y git checkout FETCH_HEAD git cherry-pick -x afbe4bc252d90a6f8fad869b06d5430f615f22f9 # git commit -s git send-email --to '' --in-reply-to '2026072916-driller-shed-862c@gregkh' --subject-prefix 'PATCH 5.10.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ From afbe4bc252d90a6f8fad869b06d5430f615f22f9 Mon Sep 17 00:00:00 2001 From: Pengpeng Hou Date: Tue, 24 Mar 2026 11:13:26 +0800 Subject: [PATCH] media: v4l2-ctrls: validate HEVC active reference counts HEVC slice parameters are shared stateless V4L2 controls, but the common validation path does not verify the active L0/L1 reference counts before driver-specific code consumes them. The original report came from Cedrus, but the active count bounds are not Cedrus-specific. Validate them in the common HEVC slice control path so stateless HEVC drivers get the same basic guarantees as soon as the control is queued. Do not reject ref_idx_l0/ref_idx_l1 entries here. Existing userspace may use out-of-range sentinel values such as 0xff for missing references, and some hardware can use that information for concealment. Keep this common check limited to the active reference counts. Fixes: d395a78db9eab ("media: hevc: Add decode params control") Cc: stable@vger.kernel.org Signed-off-by: Pengpeng Hou Reviewed-by: Nicolas Dufresne Signed-off-by: Nicolas Dufresne Signed-off-by: Hans Verkuil diff --git a/drivers/media/v4l2-core/v4l2-ctrls-core.c b/drivers/media/v4l2-core/v4l2-ctrls-core.c index 6b375720e395..ba047d7d8601 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls-core.c +++ b/drivers/media/v4l2-core/v4l2-ctrls-core.c @@ -971,6 +971,7 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx, struct v4l2_ctrl_hevc_ext_sps_st_rps *p_hevc_st_rps; struct v4l2_ctrl_hevc_sps *p_hevc_sps; struct v4l2_ctrl_hevc_pps *p_hevc_pps; + struct v4l2_ctrl_hevc_slice_params *p_hevc_slice_params; struct v4l2_ctrl_hdr10_mastering_display *p_hdr10_mastering; struct v4l2_ctrl_hevc_decode_params *p_hevc_decode_params; struct v4l2_area *area; @@ -1260,6 +1261,18 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx, break; case V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS: + p_hevc_slice_params = p; + + if (p_hevc_slice_params->num_ref_idx_l0_active_minus1 >= + V4L2_HEVC_DPB_ENTRIES_NUM_MAX) + return -EINVAL; + + if (p_hevc_slice_params->slice_type != V4L2_HEVC_SLICE_TYPE_B) + break; + + if (p_hevc_slice_params->num_ref_idx_l1_active_minus1 >= + V4L2_HEVC_DPB_ENTRIES_NUM_MAX) + return -EINVAL; break; case V4L2_CTRL_TYPE_HEVC_EXT_SPS_ST_RPS: