From patchwork Tue Mar 2 12:23:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 11444 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 1E39FBD808 for ; Tue, 2 Mar 2021 12:23:47 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9BEBF68AA8; Tue, 2 Mar 2021 13:23:46 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="iWPc9Pac"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7782E68A93 for ; Tue, 2 Mar 2021 13:23:45 +0100 (CET) Received: from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E5CE945D; Tue, 2 Mar 2021 13:23:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1614687825; bh=gUHZ3u93eEFqO1nTOQDImDkZOf9NgBBMS3+rhkj83rc=; h=From:To:Cc:Subject:Date:From; b=iWPc9PacUIJs2QUjbL7zvct867Q8UAgFvDF69jdqYPN/ZiA25ml3aFey0xd747IZ8 cwF0uUShIZ7iPeN18CUk5rdk9r0aBO4qRJP81cir2NxczZGoGPwlcVzJgK1vLI6C4n YctNhlE9z6dFg/LN6GJ9nVQWQrhKwXmJYlmy1uoo= From: Kieran Bingham To: libcamera devel Date: Tue, 2 Mar 2021 12:23:39 +0000 Message-Id: <20210302122341.83985-1-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 0/2] libcamera: Request: Catch double completions 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" If a Request is completed, when it has already been completed, this is the equivalent to a use-after-free. When completed, the application regains control of the object, and can choose to either free the memory, or call request->reuse(). In both of those scenarios the Request should not be touch by the Pipeline Handler until it is re-queued. There appear to be some races or bugs around here, so add an assert to catch this early, and fix a comment related to the usage. Kieran Bingham (2): libcamera: Request: validate state on complete libcamera: pipeline_handler: Update request usage comment src/libcamera/pipeline_handler.cpp | 4 ++-- src/libcamera/request.cpp | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-)