Message ID | 20210616103649.2662395-5-jens.wiklander@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <SRS0=alP7=LK=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=-16.9 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 BBBECC48BE6 for <linux-arm-kernel@archiver.kernel.org>; Wed, 16 Jun 2021 10:40:03 +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 873D961001 for <linux-arm-kernel@archiver.kernel.org>; Wed, 16 Jun 2021 10:40:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 873D961001 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@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=C1SgjcputOt4xmB2LPvlP4Bh8D7cRk2hVh1UTgOLv3o=; b=lk70iVOPi2PZT1 f3LQGzATU9JXoyWRaMFzzhPKt+aWwhl/vhHsFp5RthT9O0/PWhl+bSf3GMtty6A4TKvjkj7ea+4+4 1OtuepHkAMnX0fnHL8tENmArOdlaOuqg9vYLneGDsazjSdpiy0AfAxQn74ih6S/tgUcarXLofmIbc E1s7uMnKW3AL4DnELryG8/Oab7zK02XY3VIGMNTuN57zx43MU4dBhOeViH+hpH50/WbJMR8BN44NV PJkFZY+PK2QFvjue4m0VA3PLUyXZHo+AYXxvhAaiLqfS2su8VqnOZR5Zk5lfLNLLrjKMfjCDlcweQ xxEeuJ9VFe7WNSd1j83g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltSwK-005qhc-Fy; Wed, 16 Jun 2021 10:38:32 +0000 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltSv5-005qEQ-6f for linux-arm-kernel@lists.infradead.org; Wed, 16 Jun 2021 10:37:16 +0000 Received: by mail-lf1-x133.google.com with SMTP id r5so3540507lfr.5 for <linux-arm-kernel@lists.infradead.org>; Wed, 16 Jun 2021 03:37:14 -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=/f1rY0k6EQWoltoVI239rx9YFVi0YDoyX+ARCpEzBL8=; b=llG26ISbSHMQx9SAWWK0Ew5GahaWNLFUKYF3eJzC4p33bRd9Be60A93cKFvJyK4UOz zPO06ptAc1p3sQr86nkEQV8CU+83twF95m4ySOp2qgCoovEzCa6CV7PO8ZkWDLhgPps1 A+GHdG9jn2/J9PtUYjwcKSxCrFrp6ThpBnl0N9E2qlo00n53XZvUbugI9hIpCRlDBDg7 12rNUWk/l1v9+geVlXECny1yce1nLA1zjK/tyvFZ/dspVr+VBcfQmO7KIxe/fc/iVTeq 672zro9XoKRvv8/Q6nwkbWoNctEryLJwZW+t5S1qaS/IzciywYhp/zMpyQ4aduoFdfbc VQJw== 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=/f1rY0k6EQWoltoVI239rx9YFVi0YDoyX+ARCpEzBL8=; b=CbhJad2N9mqAkusJBpI6dsJ3ogogo0FVTFf6QJ2dzj4rAUS5XzVUZzNpsqHH8NwXgN y1JoaADNSvdUb6rs9CyjY5TPqjDhpJaDuqF1kTZN1tfcJaV1taOwW2I3TSGpmUDu6fs7 zVtOT27i/B4qIUmpIhaLnA7WjgRCfoUdyfdPqV/P2jB8uzb8PJYqq3kKx8xtw03tUNeX J7S2j7mukUq6DsYEUXuGUjCCbsi3TG4iWNnvA0jr41u5NvyPyr1sPNbcZHzPFxupcJ82 TpgdaENSnPm/0VJmA6TDh8oaV1rJx8/VaNuvO3rPTwH2wU97lf9Or/7xt0hxnvE1izwV PLGA== X-Gm-Message-State: AOAM53078vldLaJbxIy7bdMsuCmd/KsnSDsg1Qyss56CO9rzwfSJXJ7N xGeHKCt9h6ZdBA+AsVPwwL8veg== X-Google-Smtp-Source: ABdhPJysfxzlZ2ZCBCeU6Y2xQDldKhQEt20KJ5s961GMZJdmsWDBpqHYUiF3UpWheyplkOkqFfgg8Q== X-Received: by 2002:a19:550f:: with SMTP id n15mr3209225lfe.660.1623839833192; Wed, 16 Jun 2021 03:37:13 -0700 (PDT) Received: from jade.urgonet (h-79-136-85-3.A175.priv.bahnhof.se. [79.136.85.3]) by smtp.gmail.com with ESMTPSA id m17sm205621lfh.288.2021.06.16.03.37.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Jun 2021 03:37:12 -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 v2 4/7] tee: fix put order in teedev_close_context() Date: Wed, 16 Jun 2021 12:36:46 +0200 Message-Id: <20210616103649.2662395-5-jens.wiklander@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210616103649.2662395-1-jens.wiklander@linaro.org> References: <20210616103649.2662395-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-20210616_033715_304472_128AA02B X-CRM114-Status: GOOD ( 12.75 ) 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 480d294a23ab..f97d95b50773 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(-)