From: Laurent Pinchart Date: Wed, 18 Mar 2026 23:59:03 +0000 (+0200) Subject: media: renesas: vsp1: histo: Fix code enumeration X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a7985d28b3b13cd5e23f4271d702a46532f80424;p=thirdparty%2Fkernel%2Fstable.git media: renesas: vsp1: histo: Fix code enumeration The histogram media bus code enumeration does not check the index when operating on the source pad, resulting in an infinite loop if userspace keeps enumerating code without any loop boundary. Fix it by returning an error for indices larger than 0 as the pad supports a single format. Tested-by: Lad Prabhakar # HiHope RZ/G2M Link: https://patch.msgid.link/20260318235907.831556-10-laurent.pinchart+renesas@ideasonboard.com Signed-off-by: Laurent Pinchart Signed-off-by: Hans Verkuil --- diff --git a/drivers/media/platform/renesas/vsp1/vsp1_histo.c b/drivers/media/platform/renesas/vsp1/vsp1_histo.c index d7843c170f94..f97aecb22058 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_histo.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_histo.c @@ -168,7 +168,10 @@ static int histo_enum_mbus_code(struct v4l2_subdev *subdev, struct v4l2_subdev_mbus_code_enum *code) { if (code->pad == HISTO_PAD_SOURCE) { - code->code = MEDIA_BUS_FMT_FIXED; + if (code->index > 0) + return -EINVAL; + + code->code = MEDIA_BUS_FMT_METADATA_FIXED; return 0; }