[libcamera-devel] [PATCH v3 20/22] v4l2: v4l2_camera_proxy: Don't allow buffers to be freed if still mmaped

Paul Elder paul.elder at ideasonboard.com
Tue Jun 23 21:08:34 CEST 2020


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 at ideasonboard.com>

---
No change in v3

New in v2
- split from "Fix v4l2-compliance streaming tests"
---
 src/v4l2/v4l2_camera_proxy.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp
index dd09951..ce0d755 100644
--- a/src/v4l2/v4l2_camera_proxy.cpp
+++ b/src/v4l2/v4l2_camera_proxy.cpp
@@ -471,6 +471,9 @@ int V4L2CameraProxy::vidioc_reqbufs(V4L2CameraFile *file, struct v4l2_requestbuf
 	memset(arg->reserved, 0, sizeof(arg->reserved));
 
 	if (arg->count == 0) {
+		if (!mmaps_.empty())
+			return -EBUSY;
+
 		if (vcam_->isRunning())
 			return -EBUSY;
 
-- 
2.27.0



More information about the libcamera-devel mailing list