v4l2: v4l2_camera_proxy: Don't allow buffers to be freed if still mmaped

In VIDIOC_REQBUFS with count = 0, if the buffers are still mmaped, they
should not be allowed to be freed. Add a check for this.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Paul Elder 2020-06-18 18:46:02 +09:00
parent 4d150c7faf
commit 3f01ccf24b

View file

@ -470,6 +470,10 @@ int V4L2CameraProxy::vidioc_reqbufs(V4L2CameraFile *file, struct v4l2_requestbuf
memset(arg->reserved, 0, sizeof(arg->reserved));
if (arg->count == 0) {
/* \todo Add buffer orphaning support */
if (!mmaps_.empty())
return -EBUSY;
if (vcam_->isRunning())
return -EBUSY;