Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp839180ybi; Fri, 12 Jul 2019 05:30:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqwHHeRaXwueX6GsnPlG2mdXaZvw0YRYhXexTmXBhP9hqZV6L+hpwxeuJdT75H/RUx+l+74A X-Received: by 2002:a63:ee0c:: with SMTP id e12mr10766473pgi.184.1562934640497; Fri, 12 Jul 2019 05:30:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562934640; cv=none; d=google.com; s=arc-20160816; b=lqm/+GF04E+p/XEYbnvYth+AgcbMV7zQsyC07z1NaJIWmBDgvm/m145rrqDFGzmipE gm4hX+nkTb/m+zUN7hwK5e6ylNJLMjof0CuuNXpiW+F8OJr0S7LHJ69zXkeH50FS9EVG hv5iSU42YH/ImQyBljwbu31nx9n1Et0INOo4Wteqq4hVE8UCbDC1cxdA0P/6YBlHHsVn vX5y2iVw1UmCAmDwrxN1EKNor1hGypqhvtoxnnNMWvFpHkeK54cC5VZVLVU+4IqlSqQF DDo3S2SPiO8++0Nco2aA5RfLTm1RAjlJ2Gt++4ObXV48X0gahU19v2lo89JGbB0bGZwU Re8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=z/zD7oOWD/vWOvmR0OKnCvHotomlmTiqlVoE0R0w8zQ=; b=HZ1N/SbG54m0eAhbIYj0j5ULMNlLk9w8dw91zDsgSafQx6+CB4sOe1cCSHZtpznGe4 c8ujEL19Ec59NaukPd3lDHpgOhpNaZKuvNALiOjMVPVA+kXhX8hAjIwd2ZwAVS9cmk30 AYRJcZUPwYVR+42tZcawkrFy5PdNrIMFQGQEcMUBYCS9ujyssFtzitI4C/gv6GbmQaCl kUmAYw75J0lWdRVz90yMXqNG6PchtLRL9JlL9aRmngDOuO3Z1ajOGHE5j8zYRb60hk7I NrlbAQsJuUq5sN3n6ngd9Fp8mwVio3gEjposux/poagjK0fiC/DJ0ziiKH+tgMjRL7XP zG9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1yPGR9xu; 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 d33si7538156pla.417.2019.07.12.05.30.25; Fri, 12 Jul 2019 05:30:40 -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; dkim=pass header.i=@kernel.org header.s=default header.b=1yPGR9xu; 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 S1728968AbfGLM3W (ORCPT + 99 others); Fri, 12 Jul 2019 08:29:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:44050 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728389AbfGLM3Q (ORCPT ); Fri, 12 Jul 2019 08:29:16 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 55CCA208E4; Fri, 12 Jul 2019 12:29:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562934555; bh=eUozmw0umQg+2JTk3e8I7qyBYjnpkikBmyDnrg4C1Eo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1yPGR9xuPtK0Vi75/Py10E4sPGgATZXrIxHnK7b/HRGorn9nvfdD4A9Fgy7sKO9qy B1SCtpxmYO5IAPraO9hQgCs4Csb7ZxzRETe4OWhJcT1hyp7z003ZooklBxctq9T0vY EhCx3BsTNMa+OwXP5s6FwtMmccO+Adwlqxw9u/xM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vadim Sukhomlinov , Douglas Anderson , Jarkko Sakkinen Subject: [PATCH 5.1 094/138] tpm: Fix TPM 1.2 Shutdown sequence to prevent future TPM operations Date: Fri, 12 Jul 2019 14:19:18 +0200 Message-Id: <20190712121632.371007090@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190712121628.731888964@linuxfoundation.org> References: <20190712121628.731888964@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. Fixes: d1bd4a792d39 ("tpm: Issue a TPM2_Shutdown for TPM2 devices.") Cc: stable@vger.kernel.org Signed-off-by: Vadim Sukhomlinov [dianders: resolved merge conflicts with mainline] Signed-off-by: Douglas Anderson Reviewed-by: Jarkko Sakkinen Signed-off-by: Jarkko Sakkinen Signed-off-by: Greg Kroah-Hartman --- drivers/char/tpm/tpm-chip.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/char/tpm/tpm-chip.c +++ b/drivers/char/tpm/tpm-chip.c @@ -294,15 +294,15 @@ static int tpm_class_shutdown(struct 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); if (!tpm_chip_start(chip)) { tpm2_shutdown(chip, TPM2_SU_CLEAR); tpm_chip_stop(chip); } - chip->ops = NULL; - up_write(&chip->ops_sem); } + chip->ops = NULL; + up_write(&chip->ops_sem); return 0; }