diff mbox

[tpmdd-devel] tpm: check for TPM_CHIP_FLAG_TPM2 before calling tpm2_shutdown()

Message ID 1461576090-24813-1-git-send-email-jarkko.sakkinen@linux.intel.com
State New
Headers show

Commit Message

Jarkko Sakkinen April 25, 2016, 9:21 a.m. UTC
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Reported-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
---
 drivers/char/tpm/tpm-chip.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Jason Gunthorpe April 25, 2016, 5:57 p.m. UTC | #1
On Mon, Apr 25, 2016 at 12:21:30PM +0300, Jarkko Sakkinen wrote:
> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
> Reported-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
>  drivers/char/tpm/tpm-chip.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Reviewed-By: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Fixes: 20e0152393b41 ("tpm: fix crash in tpm_tis deinitialization")

> 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);
>  }


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
Jarkko Sakkinen April 25, 2016, 6:48 p.m. UTC | #2
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 <jarkko.sakkinen@linux.intel.com>
> > Reported-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
> >  drivers/char/tpm/tpm-chip.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> Reviewed-By: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
> 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);
> >  }
> 

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
Stefan Berger April 25, 2016, 7:09 p.m. UTC | #3
On 04/25/2016 01:57 PM, Jason Gunthorpe wrote:
> On Mon, Apr 25, 2016 at 12:21:30PM +0300, Jarkko Sakkinen wrote:
>> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
>> Reported-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
>>   drivers/char/tpm/tpm-chip.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
> Reviewed-By: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
> Fixes: 20e0152393b41 ("tpm: fix crash in tpm_tis deinitialization")

Tested-by: Stefan Berger <stefanb@linux.vnet.ibm.com>


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
diff mbox

Patch

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);
 }