From patchwork Wed May 20 15:10:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 3830 Return-Path: Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2D557603F3 for ; Wed, 20 May 2020 17:07:04 +0200 (CEST) X-Originating-IP: 2.224.242.101 Received: from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 96A1B1BF211; Wed, 20 May 2020 15:07:03 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Wed, 20 May 2020 17:10:19 +0200 Message-Id: <20200520151019.744345-1-jacopo@jmondi.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] libcamera: raspberry: Fix segfault in ~RPiCameraData() X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 May 2020 15:07:04 -0000 The RPiCameraData class destructor tries to stop its ipa_ instance without making sure it has been initialized. If the RPiCameraData gets destroyed before its ipa_ member is initialized, in example if the sensor initialization fails during the match() function. A nullptr dereference segfault is triggered preventing a graceful library teardown. Fix this by checking for ipa_ to be initialized before stopping it. Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 3 ++- src/libcamera/property_ids.yaml | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 07ca9f5d7f53..e16a9c7f10d3 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -304,7 +304,8 @@ public: } /* Stop the IPA proxy thread. */ - ipa_->stop(); + if (ipa_) + ipa_->stop(); } void frameStarted(uint32_t sequence); diff --git a/src/libcamera/property_ids.yaml b/src/libcamera/property_ids.yaml index 2ae178a73d52..da4d0bbf329c 100644 --- a/src/libcamera/property_ids.yaml +++ b/src/libcamera/property_ids.yaml @@ -398,7 +398,6 @@ controls: The property can be used to calculate the physical size of the sensor's pixel array. - - PixelArrayFullSize: type: Size description: |