Message ID | 20210826123032.1732926-4-jens.wiklander@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <SRS0=ky5b=NR=lists.infradead.org=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@kernel.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C71D4C432BE for <linux-arm-kernel@archiver.kernel.org>; Thu, 26 Aug 2021 12:33:22 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 944A860E77 for <linux-arm-kernel@archiver.kernel.org>; Thu, 26 Aug 2021 12:33:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 944A860E77 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=sE70lEnp4+d9XvD4hbYzIUazpFziEZHZGB9dg4ab5s0=; b=zMGxlprSP214Es ZA3h8pv17q6ugJUmhx1R/8rlVR9IxQasZ0M/D3D97eCROMZh0W6Z+k5kW8iTXtgM67odTPo5iBTCb 90isnA4DdIIncRghG72LrnvZMdjEVXh9O4PGNbS0vNnNurNwmLHNtDBD2yv+x+Eo0TmowrfLYtDOn slSx0UBjS28UmPpL6lse2hacafxiaD55s/sgtmKERqTLFEFniRJ1nJ22mw3QRu27lf1b5KqytpZxy OzaGj7a5DqkEVF2E6yzfNdSuGz2rGm8gTE+dwJEuVhtH1melT8PWaF3R0w3999xrp3qWrCGPaOo+P HHPKv1ZR/kvsgPe4o/Tg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mJEXf-00A41z-8a; Thu, 26 Aug 2021 12:31:35 +0000 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mJEWq-00A3qT-Hf for linux-arm-kernel@lists.infradead.org; Thu, 26 Aug 2021 12:30:50 +0000 Received: by mail-lf1-x12a.google.com with SMTP id z2so6531427lft.1 for <linux-arm-kernel@lists.infradead.org>; Thu, 26 Aug 2021 05:30:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JoodeoEbWA8KFPSDaqBt6HBmf+JeOe0hbWt7ocF/yag=; b=gZMisyRDxgH5gaSMdaSrLWrVBgnJiieFFNBcmjDx33BBp2VM2mCTz9s8UTZi7/BJ54 pZgn93V8Mcb9S2QKsXTdwwOL7O1KDzQUt56MI1ztVplj6OREFy7JveICkKz//LHg2619 TqP9/aqM54aR3TctwTgrQdMcHL7XKWQ40vrUjM4eQthXogUG6POhttFg1AzilsGCE99i 9NRja4Jhksy+I5wQyzEaxpej5QAm8Cmh03E9KSgFIEpKAkOXKTnytB9i1hD/DBRWcqN0 eOpZbST42OrMEzQxDVHyfPLETKwSeUcLfBOzZe97pbX39jafv5Gh6/x7LdtRmWVmB37c pJag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JoodeoEbWA8KFPSDaqBt6HBmf+JeOe0hbWt7ocF/yag=; b=rCi8fEGhwIBsLoB4HHI0P8wbhsreX/gV3DtWbRrUEmG4OQsPmlAesh02P6H3dZSOUn KYS+cFHWK1/DPPAdVFpRRk5mY+PVQ97fxcavTOEDPcHGVPUqX6H3oFCfvHmqKVwEzSOA 7qmeLs8WnKMrPnkSmiOybhtgD96/Ne7OwvgFtWzrHAdIvBDad0hs9uHL77iqMfq8Ymed NrvcrZ9r+lk2wUoA7cE5wrh+8GO1l4G6FixYWrdOpNDO3IRA4ee01GmbqhKsc+1/QLIB bMvQ5c18CUUsEg4tI+O0B+RAEmH/PmKCN1d9QA9jDC1VOe9J7fWVeCD13bv9jtk8TwBH bc+A== X-Gm-Message-State: AOAM5315W0P+LMc+QWVXs7Ol9VaUWdpJeGJ1FhC8Z4J/GWHlFAPgo+ej n3Y/qUiswkD+sYPqCUky3W6QWA== X-Google-Smtp-Source: ABdhPJzPoA85sfVjo4hiwKhrFd0MZiun3ogANCDG9hsxjklStOkxEllbiklrHLRGsCcjvj3zrjuTig== X-Received: by 2002:a05:6512:ad6:: with SMTP id n22mr2695207lfu.532.1629981042914; Thu, 26 Aug 2021 05:30:42 -0700 (PDT) Received: from jade.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id j21sm332283ljh.87.2021.08.26.05.30.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Aug 2021 05:30:42 -0700 (PDT) From: Jens Wiklander <jens.wiklander@linaro.org> To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, op-tee@lists.trustedfirmware.org, devicetree@vger.kernel.org, linux-doc@vger.kernel.org Cc: Jerome Forissier <jerome@forissier.org>, Etienne Carriere <etienne.carriere@linaro.org>, Sumit Garg <sumit.garg@linaro.org>, Vincent Guittot <vincent.guittot@linaro.org>, Rob Herring <robh+dt@kernel.org>, Jonathan Corbet <corbet@lwn.net>, Ard Biesheuvel <ardb@kernel.org>, Marc Zyngier <maz@kernel.org>, Jens Wiklander <jens.wiklander@linaro.org> Subject: [PATCH v5 3/6] tee: fix put order in teedev_close_context() Date: Thu, 26 Aug 2021 14:30:29 +0200 Message-Id: <20210826123032.1732926-4-jens.wiklander@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210826123032.1732926-1-jens.wiklander@linaro.org> References: <20210826123032.1732926-1-jens.wiklander@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210826_053044_623093_D6C8B175 X-CRM114-Status: GOOD ( 12.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
Asynchronous notifications from secure world
|
expand
|
diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c index 2b37bc408fc3..85102d12d716 100644 --- a/drivers/tee/tee_core.c +++ b/drivers/tee/tee_core.c @@ -98,8 +98,10 @@ void teedev_ctx_put(struct tee_context *ctx) static void teedev_close_context(struct tee_context *ctx) { - tee_device_put(ctx->teedev); + struct tee_device *teedev = ctx->teedev; + teedev_ctx_put(ctx); + tee_device_put(teedev); } static int tee_open(struct inode *inode, struct file *filp)
Prior to this patch was teedev_close_context() calling tee_device_put() before teedev_ctx_put() leading to teedev_ctx_release() accessing ctx->teedev just after the reference counter was decreased on the teedev. Fix this by calling teedev_ctx_put() before tee_device_put(). Fixes: 217e0250cccb ("tee: use reference counting for tee_context") Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> --- drivers/tee/tee_core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)