Re: [PATCH] media: qcom: camss: tpg: Skip the unnamed test pattern menu entries

From: bod

Date: Wed Nov 25 2026 - 11:49:59 EST


On 2026-10-16 15:55 +0100, George Neacsu wrote:
> The gen1 TPG names its test patterns in testgen_payload_modes[], which
> is indexed by the hardware payload mode, so entries 3, 4, 7 and 8 are
> NULL. The V4L2_CID_TEST_PATTERN menu is created with that array, a
> maximum of TPG_PAYLOAD_MODE_NUM_SUPPORTED_GEN1 and no skip mask, so
> setting the control to one of the gaps makes
> v4l2_ctrl_type_op_validate() dereference a NULL name. The oops leaves
> the control handler lock held, and a later rmmod of qcom-camss then
> hangs in v4l2_ctrl_handler_free(). v4l2-compliance -m /dev/media0 does
> both on X1E80100.
>
> Skip the menu entries that have no name, so the core rejects those
> values with -EINVAL and VIDIOC_QUERYMENU leaves them out.
>
> Tested on the Surface Pro 11 (X1E80100) with next-20261015: the menu
> lists 0, 1, 2, 5, 6 and 9, setting 3, 4, 7 or 8 returns -EINVAL,
> v4l2-compliance -m /dev/media0 completes without an oops, and qcom-camss
> unloads and loads again.
>
> Fixes: 51fe835c485b ("media: qcom: camss: tpg: Add TPG support for multiple targets")
> Cc: stable@xxxxxxxxxxxxxxx
> Assisted-by: Claude:claude-opus-5-5
> Signed-off-by: George Neacsu <geocausa@xxxxxxxxx>

Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@xxxxxxxxxx>
---
bod