This is a note to let you know that I've just added the patch titled media: v4l2-ioctl.c: readbuffers depends on V4L2_CAP_READWRITE to the 5.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: media-v4l2-ioctl.c-readbuffers-depends-on-v4l2_cap_readwrite.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From cd9d9377ed235b294a492a094e1666178a5e78fd Mon Sep 17 00:00:00 2001 From: Hans Verkuil <hverkuil-cisco@xxxxxxxxx> Date: Wed, 3 Nov 2021 12:28:31 +0000 Subject: media: v4l2-ioctl.c: readbuffers depends on V4L2_CAP_READWRITE From: Hans Verkuil <hverkuil-cisco@xxxxxxxxx> commit cd9d9377ed235b294a492a094e1666178a5e78fd upstream. If V4L2_CAP_READWRITE is not set, then readbuffers must be set to 0, otherwise v4l2-compliance will complain. A note on the Fixes tag below: this patch does not really fix that commit, but it can be applied from that commit onwards. For older code there is no guarantee that device_caps is set, so even though this patch would apply, it will not work reliably. Signed-off-by: Hans Verkuil <hverkuil-cisco@xxxxxxxxx> Fixes: 049e684f2de9 (media: v4l2-dev: fix WARN_ON(!vdev->device_caps)) Cc: <stable@xxxxxxxxxxxxxxx> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/media/v4l2-core/v4l2-ioctl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -2127,6 +2127,7 @@ static int v4l_prepare_buf(const struct static int v4l_g_parm(const struct v4l2_ioctl_ops *ops, struct file *file, void *fh, void *arg) { + struct video_device *vfd = video_devdata(file); struct v4l2_streamparm *p = arg; v4l2_std_id std; int ret = check_fmt(file, p->type); @@ -2138,7 +2139,8 @@ static int v4l_g_parm(const struct v4l2_ if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE && p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) return -EINVAL; - p->parm.capture.readbuffers = 2; + if (vfd->device_caps & V4L2_CAP_READWRITE) + p->parm.capture.readbuffers = 2; ret = ops->vidioc_g_std(file, fh, &std); if (ret == 0) v4l2_video_std_frame_period(std, &p->parm.capture.timeperframe); Patches currently in stable-queue which might be from hverkuil-cisco@xxxxxxxxx are queue-5.10/media-mceusb-fix-control-message-timeouts.patch queue-5.10/media-flexcop-usb-fix-control-message-timeouts.patch queue-5.10/media-stk1160-fix-control-message-timeouts.patch queue-5.10/media-pvrusb2-fix-control-message-timeouts.patch queue-5.10/media-s2255-fix-control-message-timeouts.patch queue-5.10/media-cpia2-fix-control-message-timeouts.patch queue-5.10/media-v4l2-ioctl.c-readbuffers-depends-on-v4l2_cap_readwrite.patch queue-5.10/media-redrat3-fix-control-message-timeouts.patch queue-5.10/media-cec-pin-fix-interrupt-en-disable-handling.patch queue-5.10/media-em28xx-fix-control-message-timeouts.patch