Re: [PATCH] tpm: fix a race condition in tpm2_unseal_trusted()

2016-08-29 Thread Jason Gunthorpe
On Mon, Aug 29, 2016 at 11:03:26PM +0300, Jarkko Sakkinen wrote: > I will also add documentation comments for tpm2_unseal_cmd, > tpm2_load_cmd and tpm2_flush_context_cmd. Do you think it is sufficient > to say "Return: same as with tpm_transmit_cmd"? yes Jason

Re: [PATCH] tpm: fix a race condition in tpm2_unseal_trusted()

2016-08-29 Thread Jarkko Sakkinen
On Mon, Aug 29, 2016 at 10:40:27PM +0300, Jarkko Sakkinen wrote: > On Mon, Aug 29, 2016 at 01:21:10PM -0600, Jason Gunthorpe wrote: > > On Mon, Aug 29, 2016 at 06:25:21PM +0300, Jarkko Sakkinen wrote: > > > On Sun, Aug 28, 2016 at 12:51:49PM -0600, Jason Gunthorpe wrote: > > > > On Sun, Aug 28, 201

Re: [PATCH] tpm: fix a race condition in tpm2_unseal_trusted()

2016-08-29 Thread Jarkko Sakkinen
On Mon, Aug 29, 2016 at 01:21:10PM -0600, Jason Gunthorpe wrote: > On Mon, Aug 29, 2016 at 06:25:21PM +0300, Jarkko Sakkinen wrote: > > On Sun, Aug 28, 2016 at 12:51:49PM -0600, Jason Gunthorpe wrote: > > > On Sun, Aug 28, 2016 at 08:36:52AM +0200, Jarkko Sakkinen wrote: > > > > > > > > @@ -576,7

Re: [PATCH] tpm: fix a race condition in tpm2_unseal_trusted()

2016-08-29 Thread Jason Gunthorpe
On Mon, Aug 29, 2016 at 06:25:21PM +0300, Jarkko Sakkinen wrote: > On Sun, Aug 28, 2016 at 12:51:49PM -0600, Jason Gunthorpe wrote: > > On Sun, Aug 28, 2016 at 08:36:52AM +0200, Jarkko Sakkinen wrote: > > > > > > @@ -576,7 +576,8 @@ static int tpm2_load(struct tpm_chip *chip, > > > goto

Re: [PATCH] tpm: fix a race condition in tpm2_unseal_trusted()

2016-08-29 Thread Jarkko Sakkinen
On Sun, Aug 28, 2016 at 12:51:49PM -0600, Jason Gunthorpe wrote: > On Sun, Aug 28, 2016 at 08:36:52AM +0200, Jarkko Sakkinen wrote: > > > > @@ -576,7 +576,8 @@ static int tpm2_load(struct tpm_chip *chip, > > goto out; > > } > > > > - rc = tpm_transmit_cmd(chip, buf.data, PAGE_

Re: [PATCH] tpm: fix a race condition in tpm2_unseal_trusted()

2016-08-28 Thread Jason Gunthorpe
On Sun, Aug 28, 2016 at 08:36:52AM +0200, Jarkko Sakkinen wrote: > > @@ -576,7 +576,8 @@ static int tpm2_load(struct tpm_chip *chip, > goto out; > } > > - rc = tpm_transmit_cmd(chip, buf.data, PAGE_SIZE, "loading blob"); > + rc = tpm_transmit_cmd(chip, buf.data, PAGE

[PATCH] tpm: fix a race condition in tpm2_unseal_trusted()

2016-08-27 Thread Jarkko Sakkinen
Unseal and load operations should be done as an atomic operation. This commit introduces unlocked tpm_transmit() so that tpm2_unseal_trusted() can do the locking by itself. v2: Introduced an unlocked unseal operation instead of changing locking strategy in order to make less intrusive bug fix