Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754959AbcDYSsw (ORCPT ); Mon, 25 Apr 2016 14:48:52 -0400 Received: from mga09.intel.com ([134.134.136.24]:56893 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754456AbcDYSsv (ORCPT ); Mon, 25 Apr 2016 14:48:51 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,533,1455004800"; d="scan'208";a="939889305" Date: Mon, 25 Apr 2016 21:48:45 +0300 From: Jarkko Sakkinen To: Jason Gunthorpe Cc: Peter Huewe , linux-security-module@vger.kernel.org, Stefan Berger , Marcel Selhorst , "moderated list:TPM DEVICE DRIVER" , open list Subject: Re: [PATCH] tpm: check for TPM_CHIP_FLAG_TPM2 before calling tpm2_shutdown() Message-ID: <20160425184845.GA15368@intel.com> References: <1461576090-24813-1-git-send-email-jarkko.sakkinen@linux.intel.com> <20160425175720.GB7675@obsidianresearch.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160425175720.GB7675@obsidianresearch.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1063 Lines: 28 On Mon, Apr 25, 2016 at 11:57:20AM -0600, Jason Gunthorpe wrote: > On Mon, Apr 25, 2016 at 12:21:30PM +0300, Jarkko Sakkinen wrote: > > Signed-off-by: Jarkko Sakkinen > > Reported-by: Stefan Berger > > drivers/char/tpm/tpm-chip.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > Reviewed-By: Jason Gunthorpe > Fixes: 20e0152393b41 ("tpm: fix crash in tpm_tis deinitialization") Thanks and thanks for the fixes line (forgot to add it) :) /Jarkko > > diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c > > index a12db8e..1965dc7 100644 > > +++ 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); > > } >