{"id":1105,"url":"https://patchwork.libcamera.org/api/patches/1105/?format=json","web_url":"https://patchwork.libcamera.org/patch/1105/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20190426141332.2782-1-niklas.soderlund@ragnatech.se>","date":"2019-04-26T14:13:32","name":"[libcamera-devel,v2] libcamera: camera: Check requests before queueing them","commit_ref":"ff24be7022b39533cce219468b6fa3ce84460f94","pull_url":null,"state":"accepted","archived":false,"hash":"a113a50476beaa05f74f078faabcb5b3206e499c","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/?format=json","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/1105/mbox/","series":[{"id":270,"url":"https://patchwork.libcamera.org/api/series/270/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=270","date":"2019-04-26T14:13:32","name":"[libcamera-devel,v2] libcamera: camera: Check requests before queueing them","version":2,"mbox":"https://patchwork.libcamera.org/series/270/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/1105/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/1105/checks/","tags":{},"headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net\n\t[195.74.38.229])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 29D2F60B2E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 26 Apr 2019 16:13:41 +0200 (CEST)","from wyvern.station (unknown [37.182.44.227])\n\tby bin-vsp-out-03.atm.binero.net (Halon) with ESMTPA\n\tid 741b3e76-682d-11e9-81fd-0050569116f7;\n\tFri, 26 Apr 2019 16:13:27 +0200 (CEST)"],"X-Halon-ID":"741b3e76-682d-11e9-81fd-0050569116f7","Authorized-sender":"niklas@soderlund.pp.se","From":"=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","To":"libcamera-devel@lists.libcamera.org","Date":"Fri, 26 Apr 2019 16:13:32 +0200","Message-Id":"<20190426141332.2782-1-niklas.soderlund@ragnatech.se>","X-Mailer":"git-send-email 2.21.0","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2] libcamera: camera: Check requests\n\tbefore queueing them","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Fri, 26 Apr 2019 14:13:41 -0000"},"content":"Make sure all requests queued to a camera only contain streams which\nhave been configured and belong to the camera.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n src/libcamera/camera.cpp | 9 +++++++++\n 1 file changed, 9 insertions(+)","diff":"diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp\nindex 655996f26224ef49..9cea3fd06238c1cb 100644\n--- a/src/libcamera/camera.cpp\n+++ b/src/libcamera/camera.cpp\n@@ -732,6 +732,7 @@ Request *Camera::createRequest()\n  * \\return 0 on success or a negative error code otherwise\n  * \\retval -ENODEV The camera has been disconnected from the system\n  * \\retval -EACCES The camera is not running so requests can't be queued\n+ * \\retval -EINVAL The request is invalid\n  */\n int Camera::queueRequest(Request *request)\n {\n@@ -741,6 +742,14 @@ int Camera::queueRequest(Request *request)\n \tif (!stateIs(CameraRunning))\n \t\treturn -EACCES;\n \n+\tfor (auto const &it : request->buffers()) {\n+\t\tStream *stream = it.first;\n+\t\tif (activeStreams_.find(stream) == activeStreams_.end()) {\n+\t\t\tLOG(Camera, Error) << \"Invalid request\";\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t}\n+\n \tint ret = request->prepare();\n \tif (ret) {\n \t\tLOG(Camera, Error) << \"Failed to prepare request\";\n","prefixes":["libcamera-devel","v2"]}