Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753962AbcDYJVw (ORCPT ); Mon, 25 Apr 2016 05:21:52 -0400 Received: from mga09.intel.com ([134.134.136.24]:59764 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753536AbcDYJVu (ORCPT ); Mon, 25 Apr 2016 05:21:50 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,532,1455004800"; d="scan'208";a="91347492" From: Jarkko Sakkinen To: Peter Huewe Cc: linux-security-module@vger.kernel.org, Stefan Berger , Jarkko Sakkinen , Marcel Selhorst , Jason Gunthorpe , tpmdd-devel@lists.sourceforge.net (moderated list:TPM DEVICE DRIVER), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] tpm: check for TPM_CHIP_FLAG_TPM2 before calling tpm2_shutdown() Date: Mon, 25 Apr 2016 12:21:30 +0300 Message-Id: <1461576090-24813-1-git-send-email-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 701 Lines: 22 Signed-off-by: Jarkko Sakkinen Reported-by: Stefan Berger --- drivers/char/tpm/tpm-chip.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c index a12db8e..1965dc7 100644 --- a/drivers/char/tpm/tpm-chip.c +++ b/drivers/char/tpm/tpm-chip.c @@ -270,7 +270,8 @@ static void tpm_del_char_device(struct tpm_chip *chip) /* Make the driver uncallable. */ down_write(&chip->ops_sem); - tpm2_shutdown(chip, TPM2_SU_CLEAR); + if (chip->flags & TPM_CHIP_FLAG_TPM2) + tpm2_shutdown(chip, TPM2_SU_CLEAR); chip->ops = NULL; up_write(&chip->ops_sem); } -- 2.7.4