Message ID | 20210818101849.602257-4-jens.wiklander@linaro.org |
---|---|
State | Superseded |
Headers | show
Delivered-To: patches@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp521267jab; Wed, 18 Aug 2021 03:19:08 -0700 (PDT) X-Received: by 2002:ac2:434b:: with SMTP id o11mr6109639lfl.102.1629281948203; Wed, 18 Aug 2021 03:19:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629281948; cv=none; d=google.com; s=arc-20160816; b=OwVBurNkiCtNosdYVzfiGJJSSrffvUbdp5kk0n1pCQ/cR8tN7fSBzp7qR1r1Wj/dON +jG6VnZeE4RwTTokcWFIHKG7fuhIxinW0uQDFi302Xgc28wsfYDy3vj71FQMEnuuyFzS GLIgRXYrvTg3/bM9nHsmd8n7IDx9XT6DR6F8742rORFBMM2Ro820S0QJyHNQmFIutWfS 5cVCR28KbCQsvgrS4cgZsgRJwYh27bt1Ww1E1htlB999wBcY19aZ7txefzR6jxtR0unD o9FUXtjDu1cbVt6jTRFvp5yQBq8w2L0iEKmlDdQqbz9NuAIV9dUY4hbBUSlIaSlyfZgm rNLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=JoodeoEbWA8KFPSDaqBt6HBmf+JeOe0hbWt7ocF/yag=; b=xeksKXwW527lCXVOTmqx7tYF1c6DZdWOcZJUkXz5PjoyfgrsaFr5u4zZqfavDmmdTn pJScbp/VxynVGqYXfQIvJs68PxfB6vX7whoHkq1n0xVNEdkFS3yPqbK500tOd9DXSgtM 7+XfE+lcyg0Rpwh6iuNDHuG5D1s2p8HELK/N+0KceeSVVxw6wuOclnYvvBzKUER/enUp NXKk77d9P7jS0QCaOHRiN1I4NnKBErtcpKlM4RzLkAiGUiXVe7wC28pp6LRQqNACEOzX EgwTH0N3gvyBE/SmAZ5mJ1BM8u3q5j+DJPcmd0D4XK4st7PLPUZ9UDARGnpI/zB/UeYe fSJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TtafLSyb; spf=pass (google.com: domain of jens.wiklander@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=jens.wiklander@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: <jens.wiklander@linaro.org> Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id c23sor1239744lfh.11.2021.08.18.03.19.08 for <patches@linaro.org> (Google Transport Security); Wed, 18 Aug 2021 03:19:08 -0700 (PDT) Received-SPF: pass (google.com: domain of jens.wiklander@linaro.org designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TtafLSyb; spf=pass (google.com: domain of jens.wiklander@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=jens.wiklander@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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=TtafLSybt2hOUnJfexb4ztfgk7g3VjwpzDU4eOcl8Afp5OKTTZO3PWGu6sn1CxpprC DMVZUaWW9/IXhfcuDc/BG0fykkwmsGx3kE7oA9QpgQKtR29qp+MQuPF7Gq5mRAn8ficE w/O9f9+t7qYGuDNWW5imwZUKFxq4emdtEGhC7UFxRJ3j7S8dPk3/GRN7luxHHZCXmWIV 9Eb+vwsmVcY29A2IJ1HJLC6aKQ/f/St1hdTr9jwOdHga4oiJzVUMjlg2Ue5aewCGzWLJ 2zmOYTl/9LEjlL/ZaN9FOIefAcIhHnct69g9JidKviwfGnoRuledX8oUxCNSzZa9BBb2 k0DA== 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=IOLiMMPEJw4mRSuak+XEZQbVcmEZBkRIMj2eYT9sMC7kIOHkwoq5vyZFQfXxvIf2mW V2Mj5DH4z+PvGZjHqxm5MDwS0C8QwtDmMZ+baXXiDZ2iObsVSfP3zVk7mMMTZsTdgv0a iHH9E1PBJyo+GDiaDrbZ9HDNHl871r6Rq85JXFYUYiDROQwc6wkzl6nCXBhvjHy96xxG OBNdoGsHIVwzxInKNgD7RtXS6mPE4wt6stS5ZChZNKQMzQA5VBcsc3E5Bn3856y9vSxQ l4alWohCj6DM2TnYB5bRGvQmvcmCiOJ8HZa2V//Ufuh7ZLgb2TpE9xIwJRv2MwDNSDw4 rRNw== X-Gm-Message-State: AOAM5334lctk8isk6RAqSjpJpQCye6776cNyjNvfibS0SVuOkmqx0XNV oeeUldCjugfldSD0Ml9B5ICvEmPw X-Google-Smtp-Source: ABdhPJxbzXfDmvRUIZrSntXWxK+DdVtbwWfdeHc8slzuivwfHGxevf3XX3s2rp5C7mCzXMGAOqBHkA== X-Received: by 2002:a05:6512:c0b:: with SMTP id z11mr5841550lfu.193.1629281947855; Wed, 18 Aug 2021 03:19:07 -0700 (PDT) Return-Path: <jens.wiklander@linaro.org> Received: from jade.urgonet (h-94-254-48-165.A175.priv.bahnhof.se. [94.254.48.165]) by smtp.gmail.com with ESMTPSA id l27sm451160lfp.245.2021.08.18.03.19.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 03:19:07 -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 v4 3/6] tee: fix put order in teedev_close_context() Date: Wed, 18 Aug 2021 12:18:46 +0200 Message-Id: <20210818101849.602257-4-jens.wiklander@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210818101849.602257-1-jens.wiklander@linaro.org> References: <20210818101849.602257-1-jens.wiklander@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit |
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(-) -- 2.31.1