summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Elder <paul.elder@ideasonboard.com>2020-06-18 18:46:02 +0900
committerPaul Elder <paul.elder@ideasonboard.com>2020-06-25 23:47:13 +0900
commit3f01ccf24b5866b23ca37bcee9e92a648363e4e1 (patch)
treebe97bfc9280bbfb47c9a592332b89463bd35d5bf /src
parent4d150c7faf8291fcd533ab721a0169c3249c26c2 (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/v4l2/v4l2_camera_proxy.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp
index e54df4e6..d0a12bc3 100644
--- a/src/v4l2/v4l2_camera_proxy.cpp
+++ b/src/v4l2/v4l2_camera_proxy.cpp
@@ -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;