[libcamera-devel] [PATCH] libcamera: camera: Check requests before queueing them

Niklas Söderlund niklas.soderlund at ragnatech.se
Mon Apr 22 20:07:40 CEST 2019


Make sure all requests queued to a camera only contains streams which
have been configured and belongs to the camera.

Signed-off-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
---
 src/libcamera/camera.cpp | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp
index 655996f26224ef49..36c7584e823eb580 100644
--- a/src/libcamera/camera.cpp
+++ b/src/libcamera/camera.cpp
@@ -747,6 +747,15 @@ int Camera::queueRequest(Request *request)
 		return ret;
 	}
 
+	for (auto const &it : request->buffers()) {
+		Stream *stream = it.first;
+		if (activeStreams_.find(stream) == activeStreams_.end()) {
+			LOG(Camera, Error)
+				<< "Attempt to queue request with invalid stream";
+			return -EINVAL;
+		}
+	}
+
 	return pipe_->queueRequest(this, request);
 }
 
-- 
2.21.0



More information about the libcamera-devel mailing list