{"id":13577,"url":"https://patchwork.libcamera.org/api/patches/13577/?format=json","web_url":"https://patchwork.libcamera.org/patch/13577/","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":"<20210831080528.835236-1-hiroh@chromium.org>","date":"2021-08-31T08:05:28","name":"[libcamera-devel] android: camera_device: Fix crash in calling CameraDevice::close()","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"662a019f548ea74df753b0a96ed048d7de476552","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/people/63/?format=json","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/13577/mbox/","series":[{"id":2425,"url":"https://patchwork.libcamera.org/api/series/2425/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2425","date":"2021-08-31T08:05:28","name":"[libcamera-devel] android: camera_device: Fix crash in calling CameraDevice::close()","version":1,"mbox":"https://patchwork.libcamera.org/series/2425/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/13577/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/13577/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 167D2BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 31 Aug 2021 08:05:39 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6AC076916A;\n\tTue, 31 Aug 2021 10:05:38 +0200 (CEST)","from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com\n\t[IPv6:2607:f8b0:4864:20::52a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DDD2060288\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 31 Aug 2021 10:05:36 +0200 (CEST)","by mail-pg1-x52a.google.com with SMTP id k24so15865152pgh.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 31 Aug 2021 01:05:36 -0700 (PDT)","from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:203:3c62:aba4:18ea:5441])\n\tby smtp.gmail.com with ESMTPSA id\n\tm28sm20117913pgl.9.2021.08.31.01.05.32\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 31 Aug 2021 01:05:34 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"NHY9pqJs\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; h=from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=OfgCFpUg5bxmnBY7sJSl/IFw+BTnL273/QXyF1Oy1Ec=;\n\tb=NHY9pqJs1vs8rLQ1nL2HX/hz/gvtLEH8jXvwYyJ3mLsPXlrKkHbaRIU5RXP4mVCC7O\n\t1yc99AAcRus4HnUUc3hrL1QZLCy4N1CbZH5euDqj+3v3eAvBrHpyROdL7yHmzyZJRoeg\n\tNZTHNFqjCkPJptg5VoFPCUUS+qtOFKlwYghCM=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=OfgCFpUg5bxmnBY7sJSl/IFw+BTnL273/QXyF1Oy1Ec=;\n\tb=nh2/CNwd4j9mlKEnhS5POY/JhbzkFLt0z3dPsmVcbAh/sBCVf9AzKkibw6WlU33dZz\n\tHxi6h1gsc9cmRp4Itt295rr44Y92eYEyHPTMhBiCLYbIf6OE8vO2nE25jvxKPxxr/JGl\n\tdOyNWdFhSIybTGa4Y5S6ekL7H8r1o7cjnQMKCDWqDj5gkvzNjJjg+oxSX7uu43qzQhRH\n\tq3GnyGrODZgZIY3KY/7NxY1um4Hupj3b1bMrCkM1znLoQXWpc3qUFNIaXkqwEmV+nfWy\n\teVehX3ggxWlW7TsVNJKOlY8AdYdaDj9bWOdUShFRJItBMjNyfMa8J96BwRWj4igxyA7y\n\tbIGg==","X-Gm-Message-State":"AOAM53138sVZBLA4bidyqFHQpnMcwNceimAD998sBUsnNzHaUSjByq5P\n\tuJ+a4La9+q7DPbBchDj/A4JeVJsyyhmByw==","X-Google-Smtp-Source":"ABdhPJx+Egh5JE/GQGBOm9zIU3ul6hylc/IF2de5OBC2+ZvxN1vyw29Qibj3xyhiLPW0MllUvYoqqw==","X-Received":"by 2002:a62:17c3:0:b0:3f5:b942:119e with SMTP id\n\t186-20020a6217c3000000b003f5b942119emr19718967pfx.53.1630397134967; \n\tTue, 31 Aug 2021 01:05:34 -0700 (PDT)","From":"Hirokazu Honda <hiroh@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 31 Aug 2021 17:05:28 +0900","Message-Id":"<20210831080528.835236-1-hiroh@chromium.org>","X-Mailer":"git-send-email 2.33.0.259.gc128427fd7-goog","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH] android: camera_device: Fix crash in\n\tcalling CameraDevice::close()","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":"This fixes the crash when post processing is needed and some capture\nrequest is being processed by PipelineHandler upon calling\nCameraDevice::close().\nThe crash happens in Request::completeBuffer(), which is invoked by\nCamera::stop(). It uses FrameBuffer after free. The FrameBuffer is\nallocated and owned by FrameBufferAllocator, and FrameBufferAllocator\nis owned by CamerStream. So Camera::stop() should be executed before\ndestroying CameraStream.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n src/android/camera_device.cpp | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)","diff":"diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex 8ca76719..74a95a2a 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -423,10 +423,10 @@ int CameraDevice::open(const hw_module_t *hardwareModule)\n \n void CameraDevice::close()\n {\n-\tstreams_.clear();\n-\n \tstop();\n \n+\tstreams_.clear();\n+\n \tcamera_->release();\n }\n \n","prefixes":["libcamera-devel"]}