summaryrefslogtreecommitdiff
path: root/src/v4l2
diff options
context:
space:
mode:
Diffstat (limited to 'src/v4l2')
-rw-r--r--src/v4l2/v4l2_camera_proxy.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp
index f3470a6d..e114d09f 100644
--- a/src/v4l2/v4l2_camera_proxy.cpp
+++ b/src/v4l2/v4l2_camera_proxy.cpp
@@ -104,8 +104,16 @@ void *V4L2CameraProxy::mmap(V4L2CameraFile *file, void *addr, size_t length,
MutexLocker locker(proxyMutex_);
- /* \todo Validate prot and flags properly. */
- if (prot != (PROT_READ | PROT_WRITE)) {
+ /*
+ * Mimic the videobuf2 behaviour, which requires PROT_READ and
+ * MAP_SHARED.
+ */
+ if (!(prot & PROT_READ)) {
+ errno = EINVAL;
+ return MAP_FAILED;
+ }
+
+ if (!(flags & MAP_SHARED)) {
errno = EINVAL;
return MAP_FAILED;
}