{"id":15469,"url":"https://patchwork.libcamera.org/api/1.1/patches/15469/?format=json","web_url":"https://patchwork.libcamera.org/patch/15469/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20220317131726.1483971-1-kieran.bingham@ideasonboard.com>","date":"2022-03-17T13:17:26","name":"[libcamera-devel] libcamera: camera: Ensure requests belong to the camera","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"267eb6eda0f1c4da78d5c9c80c3f13f0c82a828f","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/1.1/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":{"id":11,"url":"https://patchwork.libcamera.org/api/1.1/users/11/?format=json","username":"kbingham","first_name":"Kieran","last_name":"Bingham","email":"kieran.bingham@ideasonboard.com"},"mbox":"https://patchwork.libcamera.org/patch/15469/mbox/","series":[{"id":2971,"url":"https://patchwork.libcamera.org/api/1.1/series/2971/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2971","date":"2022-03-17T13:17:26","name":"[libcamera-devel] libcamera: camera: Ensure requests belong to the camera","version":1,"mbox":"https://patchwork.libcamera.org/series/2971/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/15469/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/15469/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\r\n\t[92.243.16.209])\r\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 67648BF415\r\n\tfor <parsemail@patchwork.libcamera.org>;\r\n\tThu, 17 Mar 2022 13:17:32 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\r\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C7CF5604E9;\r\n\tThu, 17 Mar 2022 14:17:31 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\r\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\r\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3FC9E601F8\r\n\tfor <libcamera-devel@lists.libcamera.org>;\r\n\tThu, 17 Mar 2022 14:17:30 +0100 (CET)","from Monstersaurus.ksquared.org.uk.beta.tailscale.net\r\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\r\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id BF7FC493;\r\n\tThu, 17 Mar 2022 14:17:29 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\r\n\ts=mail; t=1647523051;\r\n\tbh=AAoAudW3c74ZeOc34gLEe8dgQFy+Rxh3+/Hjofl6Crs=;\r\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\r\n\tList-Help:List-Subscribe:From:Reply-To:From;\r\n\tb=wAMaFHJyQGWPPzO8VqtLHl6m0ch330c4YGbG4DKmmFQ1K+9Pwva03aI3J7GLKE9Tn\r\n\tgYdbmTdK/dzXcEpx5H3mtwX7MLcD+aoZxR1FWS6bMaB7u1Yub8nRzd666wiH9vDX20\r\n\tr++Mx/sLJK4vd38MwIDabdT3DQJk6EyzVcInk58R+o4QzNDQM66P0CtFotnSsBLmYA\r\n\tN5etZaQHNdr+2y/mvgH+DN1ijE4if6XjX3svosX+fPc4fIy20CSGcIbEctb8kpipDf\r\n\tgcz9jORa2jNwRKrDblhJrsXAu+dbR+jH1xsQQFogyNr2hTBeGNg9F8gd8l6urGz1A/\r\n\towWgqHpTmKJIQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\r\n\ts=mail; t=1647523049;\r\n\tbh=AAoAudW3c74ZeOc34gLEe8dgQFy+Rxh3+/Hjofl6Crs=;\r\n\th=From:To:Cc:Subject:Date:From;\r\n\tb=ujWYogm1ZfSTfoFwCwQD4p/AY1zeoWr9ltXMTsP9Jq2zRcd+NUT4+vy8WuCX8wrdB\r\n\tDlmRm46HCDJr92gja1RK+rINTb/2BIOoB30rUnueFNAnqY1GGcKTDO3YouN5gtjCD6\r\n\tnaHPTBu3BvtQDIyr8LpJlqu03e71u6ae1duBWEaU="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \r\n\tunprotected) header.d=ideasonboard.com\r\n\theader.i=@ideasonboard.com\r\n\theader.b=\"ujWYogm1\"; dkim-atps=neutral","To":"libcamera devel <libcamera-devel@lists.libcamera.org>","Date":"Thu, 17 Mar 2022 13:17:26 +0000","Message-Id":"<20220317131726.1483971-1-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.32.0","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH] libcamera: camera: Ensure requests belong\r\n\tto the camera","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\r\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>,\r\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Kieran Bingham via libcamera-devel\r\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Requests are created by a Camera, and can only be queued\nto that specific Camera. Enforce this during the public API\nto prevent mis-use by incorrect applications.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/libcamera/camera.cpp | 7 +++++++\n 1 file changed, 7 insertions(+)","diff":"diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp\r\nindex bb856d606f4a..dd6552e83eee 100644\r\n--- a/src/libcamera/camera.cpp\r\n+++ b/src/libcamera/camera.cpp\r\n@@ -23,6 +23,7 @@\r\n #include \"libcamera/internal/camera_controls.h\"\r\n #include \"libcamera/internal/formats.h\"\r\n #include \"libcamera/internal/pipeline_handler.h\"\r\n+#include \"libcamera/internal/request.h\"\r\n \r\n /**\r\n  * \\file libcamera/camera.h\r\n@@ -1119,6 +1120,12 @@ int Camera::queueRequest(Request *request)\r\n \tif (ret < 0)\r\n \t\treturn ret;\r\n \r\n+\t/* Requests can only be queued to the camera that created them.*/\r\n+\tif (request->_d()->camera() != this) {\r\n+\t\tLOG(Camera, Error) << \"Request was not created by this camera\";\r\n+\t\treturn -EINVAL;\r\n+\t}\r\n+\r\n \t/*\r\n \t * The camera state may change until the end of the function. No locking\r\n \t * is however needed as PipelineHandler::queueRequest() will handle","prefixes":["libcamera-devel"]}