diff options
author | Kieran Bingham <kieran.bingham@ideasonboard.com> | 2023-01-30 18:02:43 +0000 |
---|---|---|
committer | Kieran Bingham <kieran.bingham@ideasonboard.com> | 2023-03-21 23:47:59 +0000 |
commit | e39f046f660a6d0954d81b92bd183e7ba679fa56 (patch) | |
tree | e1053e53c114a0bbecbe5ebde4c7c05c8711d074 /src | |
parent | d9371444c487878e0bc37e89441d025efc0f3567 (diff) |
libcamera: camera: Ensure queued requests are invalid
Invalid, or not correctly reset requests can cause undefined behaviour
in the pipeline handlers due to unexpected request state.
If the status has not been reset to Request::RequestPending, it is
either not new, or has not been correctly procesed through
Request::reuse().
This can be caught early by validating the status of the request when it
is queued to a camera.
Reject invalid requests before processing them in the pipeline handlers.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/libcamera/camera.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp index 0da167a7..99683e49 100644 --- a/src/libcamera/camera.cpp +++ b/src/libcamera/camera.cpp @@ -1126,6 +1126,11 @@ int Camera::queueRequest(Request *request) return -EXDEV; } + if (request->status() != Request::RequestPending) { + LOG(Camera, Error) << request->toString() << " is not valid"; + return -EINVAL; + } + /* * The camera state may change until the end of the function. No locking * is however needed as PipelineHandler::queueRequest() will handle |