Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp6557482ybn; Sun, 29 Sep 2019 23:17:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqzEEYYhUYbY7CFxUSaW/RijcDihlI5PqcDQNnmLS3s61ydVLql2xK0CBMicyTOUBzITeapJ X-Received: by 2002:a17:906:d0d2:: with SMTP id bq18mr17956183ejb.233.1569824226693; Sun, 29 Sep 2019 23:17:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569824226; cv=none; d=google.com; s=arc-20160816; b=MaRiLTGugtbFTRdJKgjE+YGc9tK9iuz5yLlfmFqL47aMAJyXjmvi/qFKBjq0X3SdE9 IFXFNqLzSmGkmUCKGGNifUtg1gpBcVMBqRucDRyYgLLBwQMeVkg0k/loEoP6REyzQuzK rTaIjSli9l2hq0edGyw8RiXVWqgIIoZdgQS5LjKg/Gvob8A9sI5pFXn/ItHI2Ow24Gw+ Gg85ifqW0oQ37bBstAxXTPOXih8AKuq8HNMmjkGqSEbjCBI3B1DQZYngOuveqgQxtdCr ifTJgLMdKzEVoCh8v9jRRPQimWrGJBVM00WXwSsDNrJOjw1PvIWYVtXmhQ+hAuo94mV8 qSMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=/u5Cdl8L07FOm1rRkfL/aKzHrvZVX4UGfJAr17c+860=; b=VQ39HmBbIIb0ijmpwDBbSeMImv787bPLt2QimS1TQ502tfB6QthoYYqmqSJSorSVz/ V9Q0/D+ZZRv/+p9Ot0mspDtl47OaWPWdpAK9StFv1291Keagu/XrCn3DUCDdSJa8VJOd MV1RW6CL3qyrv6/fpiP2zgyh1Q7G2UOep7clx8BOTNxdXwMKwtGoMupDge9kN5cMLrjM jdTsPb5O3jDlHaWe8pNDJC/UeJT9w5mE75g4tkh0chZ6pbI0G9nPHlR+3Jg0Wq1Q85Xh r5dvsqjeYy0E6XA3d/5t3uyTy3xYR/QvmC+lc6lThW7G6qWYyxc9lxF/MCJIOnfXTr0L 2FHw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id hh9si6380101ejb.313.2019.09.29.23.16.42; Sun, 29 Sep 2019 23:17:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729533AbfI3GOE (ORCPT + 99 others); Mon, 30 Sep 2019 02:14:04 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:33427 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725767AbfI3GOE (ORCPT ); Mon, 30 Sep 2019 02:14:04 -0400 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id D7D45802BC; Mon, 30 Sep 2019 08:13:46 +0200 (CEST) Date: Mon, 30 Sep 2019 08:13:46 +0200 From: Pavel Machek To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Vadim Sukhomlinov , Douglas Anderson , Jarkko Sakkinen , Sasha Levin Subject: Re: [PATCH 4.19 33/63] tpm: Fix TPM 1.2 Shutdown sequence to prevent future TPM operations Message-ID: <20190930061346.GA22914@atrey.karlin.mff.cuni.cz> References: <20190929135031.382429403@linuxfoundation.org> <20190929135038.128262622@linuxfoundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190929135038.128262622@linuxfoundation.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > From: Vadim Sukhomlinov > > commit db4d8cb9c9f2af71c4d087817160d866ed572cc9 upstream > > TPM 2.0 Shutdown involve sending TPM2_Shutdown to TPM chip and disabling > future TPM operations. TPM 1.2 behavior was different, future TPM > operations weren't disabled, causing rare issues. This patch ensures > that future TPM operations are disabled. > diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c > index 46caadca916a0..dccc61af9ffab 100644 > --- a/drivers/char/tpm/tpm-chip.c > +++ b/drivers/char/tpm/tpm-chip.c > @@ -187,12 +187,15 @@ static int tpm_class_shutdown(struct device *dev) > { > struct tpm_chip *chip = container_of(dev, struct tpm_chip, dev); > > + down_write(&chip->ops_sem); > if (chip->flags & TPM_CHIP_FLAG_TPM2) { > down_write(&chip->ops_sem); > tpm2_shutdown(chip, TPM2_SU_CLEAR); > chip->ops = NULL; > up_write(&chip->ops_sem); > } > + chip->ops = NULL; > + up_write(&chip->ops_sem); This is wrong, it takes &chip->ops_sem twice, that can't be good. db4d8cb9c9f2af71c4d087817160d866ed572cc9 does not have that problem. Best regards, Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html