From mboxrd@z Thu Jan 1 00:00:00 1970 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 3852B3F23D1; Mon, 17 Aug 2026 14:29:02 +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=1786976944; cv=none; b=QYk/MYiqTftvdvM9B/wMdE/0pgfh/KRPgXuU1rLukJuuJJGiXOFgUH7W3dFIoVY8bpTFrJtZeWzXOpxVqtFRR0ntYHx/k//jpNsSNZbjNIMgUhZUw6xuDrGQjmL83yL7Q4++A3WsXf7+VTPwE3Ovc3J9lEGp+sn7p20U9IP5bBQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786976944; c=relaxed/simple; bh=GdYD2o5IdxvUe0mtmAVCgDFvOFipnCiqkBupvoOFSxM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Rr+8Zc1uJE6bQABxGkPzQbvqOavnvb/8VcMp8FMbfNQmhylrWLIQUYKmdG2btaVV+BPkECyjC9yvBpF3+NpQxOMBM9EcDcCgqzrZLTL17FlBShjZhpI6DGEp9cDmadVSFRjTFIDjCf4RDddtVwru2JiTzMSrmOdaXt0GZMZT+Fw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=NXtIhs3c; 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="NXtIhs3c" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 529DE1F000E9; Mon, 17 Aug 2026 14:29:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1786976942; bh=tKO4x7dgZXRv5JioTzlqwNiGXd+AgyMZCwGR9WgfUL4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=NXtIhs3cY76oNr5CbRRg6knRpJcCrnv6jyE+aI9/MT2Wprwqxr9725VS2Zc0Cmt+T eESPJzT9RCJhJ/7lvyTLUFYqoFrQzOiN+0EYtNs3Di8Al73f303Gm27cmBexG2HODh NEpBxjYGkR9Ej7y1U2+BTmSfU8cChCX2ukuNsq1c= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Pengpeng Hou , Nicolas Dufresne , Jernej Skrabec , Chen-Yu Tsai , Hans Verkuil Subject: [PATCH 5.15 159/456] media: cedrus: skip invalid H.264 reference list entries Date: Mon, 17 Aug 2026 15:29:09 +0200 Message-ID: <20260817132546.301238016@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260817132539.792407575@linuxfoundation.org> References: <20260817132539.792407575@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 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Pengpeng Hou commit 10358ea986c3c85516d1c8206486464f79d36e76 upstream. Cedrus consumes H.264 ref_pic_list0/ref_pic_list1 entries from the stateless slice control and later uses their indices to look up decode->dpb[] in _cedrus_write_ref_list(). Rejecting such controls in cedrus_try_ctrl() would break existing userspace, since stateless H.264 reference lists may legitimately carry out-of-range indices for missing references. Instead, guard the actual DPB lookup in Cedrus and skip entries whose indices do not fit the fixed V4L2_H264_NUM_DPB_ENTRIES array. This keeps the fix local to the driver use site and avoids out-of-bounds reads from malformed or unsupported reference list entries. Fixes: e000e1fa4bdbd ("media: uapi: h264: Update reference lists") Cc: stable@vger.kernel.org Signed-off-by: Pengpeng Hou Reviewed-by: Nicolas Dufresne Acked-by: Jernej Skrabec Tested-by: Chen-Yu Tsai Signed-off-by: Nicolas Dufresne Signed-off-by: Hans Verkuil Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/sunxi/cedrus/cedrus_h264.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c @@ -190,6 +190,9 @@ static void _cedrus_write_ref_list(struc u8 dpb_idx; dpb_idx = ref_list[i].index; + if (dpb_idx >= V4L2_H264_NUM_DPB_ENTRIES) + continue; + dpb = &decode->dpb[dpb_idx]; if (!(dpb->flags & V4L2_H264_DPB_ENTRY_FLAG_ACTIVE))