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 BBA012D9EED; Wed, 30 Sep 2026 19:15:08 +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=1790795709; cv=none; b=GSL4soCqgj3CdZx7ks4o2WYKvPLvWDwuv+Y4V9fsMftVnW1q4MWg0tAM+cRklmWfIq8lThw6xQhax34rYZ5pAq9aal58nWvQtjDU15prpsO87k+QTd0Hf7SQVWFXdQjYna8EaBlyo/74Tj/WkJWjWgv2Z25dz5wkXKbgU4HPEXw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790795709; c=relaxed/simple; bh=CgTuxjUt3PArSLcGjESykZ1k8jU71kmZe8PuJZx7sMs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dTsyBBl9OyqVd5fpFO6foJmvq8v37f1zGX6LwmEgSmwXUy3xPoHt0s3iujjo5uEbrLLtTADHTK1yeS6EbO8eczidAwICEWoXEDdEW+xHhbrjT3m+B0ijhv/9NWeO7GZPC8H14NTai/trv6i0VSHq9+9gjA0mhDivhSE07vdL8no= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=LeFAg1sN; 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="LeFAg1sN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CDAA71F000FF; Wed, 30 Sep 2026 19:15:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1790795708; bh=4wRmBWVEfHyWep5fFhPw3eGkKu6RAtlsz9y3B+tSJ5w=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=LeFAg1sNVqnCPV+NSzM9p9gI1auS0kT1wZBw/OkE8MBRwBG/myE/peajGl+Sz8QP3 B6yqma7WJ/9X9kVtPNFRajXJEehgeWwRZkAk0TxBjgC0mb6SPgxPHcK1PLwyFhuEh+ wDk4CKPem7dpZHaU2FrqDDtUaEqNy+syPA5/+YBU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Michael Bommarito , Benjamin Gaignard , Hans Verkuil Subject: [PATCH 6.6 0654/1193] media: v4l2-ctrls: validate HEVC tile counts Date: Wed, 30 Sep 2026 17:22:18 +0200 Message-ID: <20260930152448.776336246@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260930152434.301151190@linuxfoundation.org> References: <20260930152434.301151190@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.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Michael Bommarito commit dc694a9929f7cb9c88ef91e45eb982b7bbe5a477 upstream. The stateless HEVC decoders read num_tile_columns_minus1 + 1 entries from column_width_minus1[] and num_tile_rows_minus1 + 1 from row_height_minus1[] and use them as tile-loop bounds, but std_validate_compound() does not bound these u8 counts. Reject a V4L2_CTRL_TYPE_HEVC_PPS with tiling enabled whose tile counts exceed the uAPI array capacity, mirroring the existing compound-control range checks. Fixes: 256fa3920874 ("media: v4l: Add definitions for HEVC stateless decoding") Assisted-by: Claude:claude-opus-4-8 Cc: stable@vger.kernel.org Signed-off-by: Michael Bommarito Reviewed-by: Benjamin Gaignard Signed-off-by: Hans Verkuil Signed-off-by: Greg Kroah-Hartman --- drivers/media/v4l2-core/v4l2-ctrls-core.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) --- a/drivers/media/v4l2-core/v4l2-ctrls-core.c +++ b/drivers/media/v4l2-core/v4l2-ctrls-core.c @@ -1080,6 +1080,18 @@ static int std_validate_compound(const s p_hevc_pps->flags &= ~V4L2_HEVC_PPS_FLAG_LOOP_FILTER_ACROSS_TILES_ENABLED; + } else { + /* + * These count the entries the stateless HEVC drivers + * read from column_width_minus1[] / row_height_minus1[] + * and use as tile-loop bounds. + */ + if (p_hevc_pps->num_tile_columns_minus1 >= + ARRAY_SIZE(p_hevc_pps->column_width_minus1)) + return -EINVAL; + if (p_hevc_pps->num_tile_rows_minus1 >= + ARRAY_SIZE(p_hevc_pps->row_height_minus1)) + return -EINVAL; } if (p_hevc_pps->flags &