Patch Detail
Show a patch.
GET /api/patches/13925/?format=api
{ "id": 13925, "url": "https://patchwork.libcamera.org/api/patches/13925/?format=api", "web_url": "https://patchwork.libcamera.org/patch/13925/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20210924130559.418704-1-umang.jain@ideasonboard.com>", "date": "2021-09-24T13:05:59", "name": "[libcamera-devel,v2] android: camera_device: Fix race on queuing capture request", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "33514d01328979a6d7c9b170f3ce03e769cccc94", "submitter": { "id": 86, "url": "https://patchwork.libcamera.org/api/people/86/?format=api", "name": "Umang Jain", "email": "umang.jain@ideasonboard.com" }, "delegate": { "id": 12, "url": "https://patchwork.libcamera.org/api/users/12/?format=api", "username": "uajain", "first_name": "Umang", "last_name": "Jain", "email": "umang.jain@ideasonboard.com" }, "mbox": "https://patchwork.libcamera.org/patch/13925/mbox/", "series": [ { "id": 2564, "url": "https://patchwork.libcamera.org/api/series/2564/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2564", "date": "2021-09-24T13:05:59", "name": "[libcamera-devel,v2] android: camera_device: Fix race on queuing capture request", "version": 2, "mbox": "https://patchwork.libcamera.org/series/2564/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/13925/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/13925/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 4EE1ABDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 24 Sep 2021 13:06:08 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BFC8D6918C;\n\tFri, 24 Sep 2021 15:06:07 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D99E0687DD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 24 Sep 2021 15:06:06 +0200 (CEST)", "from perceval.ideasonboard.com (unknown [103.251.226.51])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B072D45E;\n\tFri, 24 Sep 2021 15:06:05 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"IbeQ6xkG\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1632488766;\n\tbh=A+r5vrC4JI6iRTRVflqlyBcybsilHp0Wb3GTQ+FC0rw=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=IbeQ6xkGU2uwld51tHpSYyocNpKysMIMJtUdoGtEpBd7UAL/5Ifi166CCqzG2pYY3\n\tePQlQ/PvsDfCVDnJvSSrO8qBbTIKxlGoHxJU8tfIjk4ONMci3smAUiN8AqyYEr2mR/\n\tCh1s4OuHH3eWQHE8Od+Y0qtkvCvz7LMXbLp7UCUo=", "From": "Umang Jain <umang.jain@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 24 Sep 2021 18:35:59 +0530", "Message-Id": "<20210924130559.418704-1-umang.jain@ideasonboard.com>", "X-Mailer": "git-send-email 2.31.1", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2] android: camera_device: Fix race on\n\tqueuing capture request", "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>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "The Camera3RequestDescriptor containing the capture request\nis adding to the descriptors_ map after a call to\nCameraWorker::queueRequest(). This is a race condition since\nCameraWorker::queueRequest() queues request to libcamera::Camera\nasynchronously and the addition of the descriptor to the map\noccurs with std::move(). Hence, it might happen that the async\nqueueRequest() hasn't finished but the descriptor gets std::move()ed.\n\nFix it by adding the descriptor to map first, before\nCameraWorker::queueRequest().\n\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\n---\nchanges in v2:\n- Save the pointer first and directly use it to queueRequest()\n after std::move\n---\n src/android/camera_device.cpp | 4 +++-\n 1 file changed, 3 insertions(+), 1 deletion(-)", "diff": "diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex 21844e51..ab381168 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -1065,13 +1065,15 @@ int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reques\n \t\tstate_ = State::Running;\n \t}\n \n-\tworker_.queueRequest(descriptor.request_.get());\n+\tCaptureRequest *request = descriptor.request_.get();\n \n \t{\n \t\tMutexLocker descriptorsLock(descriptorsMutex_);\n \t\tdescriptors_[descriptor.request_->cookie()] = std::move(descriptor);\n \t}\n \n+\tworker_.queueRequest(request);\n+\n \treturn 0;\n }\n \n", "prefixes": [ "libcamera-devel", "v2" ] }