{"id":18225,"url":"https://patchwork.libcamera.org/api/patches/18225/?format=json","web_url":"https://patchwork.libcamera.org/patch/18225/","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":"<20230130180244.2150205-2-kieran.bingham@ideasonboard.com>","date":"2023-01-30T18:02:43","name":"[libcamera-devel,1/2] libcamera: camera: Ensure queued requests are prepared","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"c50ce3b7c29be69419d456df49f44c61069f1910","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/18225/mbox/","series":[{"id":3732,"url":"https://patchwork.libcamera.org/api/series/3732/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3732","date":"2023-01-30T18:02:42","name":"Camera/Request reliability","version":1,"mbox":"https://patchwork.libcamera.org/series/3732/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/18225/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/18225/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\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id DBC30C328C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 30 Jan 2023 18:02:51 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D5314625EA;\n\tMon, 30 Jan 2023 19:02:50 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8B0A7625D8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 30 Jan 2023 19:02:48 +0100 (CET)","from Monstersaurus.local\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1B09F8CC;\n\tMon, 30 Jan 2023 19:02:48 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1675101770;\n\tbh=3if+N+QqMPI/yb8qphMcMG4atLJELfDyvREaFZdGC9A=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=cb/wKF4vu1bALQ8xWwa0e6fSDkXREpjqaUX+5JnfqXwqgSbP1ABIOIwic7E71yRed\n\tr5cZAjJHGs9IspoIDMBDO2pB3sgzHSMxPtD+DUBaa5aWG5TxC9gA/ATVIzazBnBbTO\n\tr05phQ/Xs0+HnRiz8QCyUbX1GUtlg1B7ZlWhXyTpMS9KkBzR1RDu8EiNQguXS8Tvhr\n\teYeCuV4s7trd+ydMkLs0/Fvf7tQPsfEkV1LfNWgNbUsR3qIb2IeWyZvnD1uAjsJs6j\n\tYiHlH/gvSp0mtMWehnkGGYCDuXFRzt2cx9cYSaCeRLLaucXre+MWJ1KmLGTwsRWHpy\n\tHWlFK1ECa8s1A==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1675101768;\n\tbh=3if+N+QqMPI/yb8qphMcMG4atLJELfDyvREaFZdGC9A=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=R0LNEK6q3BATS8V0YROJyUjO5Mf5VFM9Do3IX8FtX8jY0pbAwcKF1BZ0C81AuUnVr\n\tcf6OB3q6Z80QJI1eQ5VkhVn09Vre/RJ8fZmL7qWQJcjosjPrd9SpJ6GPl9r6EMAynF\n\t5dusCf+pIzcNSdl7RR7esaQxd9Ov3y3kypFgXUr0="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"R0LNEK6q\"; dkim-atps=neutral","To":"libcamera devel <libcamera-devel@lists.libcamera.org>","Date":"Mon, 30 Jan 2023 18:02:43 +0000","Message-Id":"<20230130180244.2150205-2-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20230130180244.2150205-1-kieran.bingham@ideasonboard.com>","References":"<20230130180244.2150205-1-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 1/2] libcamera: camera: Ensure queued\n\trequests are prepared","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>,\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>","From":"Kieran Bingham via libcamera-devel\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":"Invalid, or not correctly reset requests can cause undefined behaviour\nin the pipeline handlers due to unexpected request state.\n\nIf the status has not been reset to Request::RequestPending, it is\neither not new, or has not been correctly procesed through\nRequest::reuse().\n\nThis can be caught early by validating the status of the request when it\nis queued to a camera.\n\nReject invalid requests before processing them in the pipeline handlers.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/libcamera/camera.cpp | 5 +++++\n 1 file changed, 5 insertions(+)","diff":"diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp\nindex 0da167a7bc51..48bf19b28979 100644\n--- a/src/libcamera/camera.cpp\n+++ b/src/libcamera/camera.cpp\n@@ -1126,6 +1126,11 @@ int Camera::queueRequest(Request *request)\n \t\treturn -EXDEV;\n \t}\n \n+\tif (request->status() != Request::RequestPending) {\n+\t\tLOG(Camera, Error) << request->toString() << \" is not prepared\";\n+\t\treturn -EINVAL;\n+\t}\n+\n \t/*\n \t * The camera state may change until the end of the function. No locking\n \t * is however needed as PipelineHandler::queueRequest() will handle\n","prefixes":["libcamera-devel","1/2"]}