All of lore.kernel.org
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] tpm: Fix TPM 1.2 Shutdown sequence to prevent future TPM" failed to apply to 4.19-stable tree
@ 2019-07-11 11:35 gregkh
  2019-07-11 16:30 ` Doug Anderson
  0 siblings, 1 reply; 5+ messages in thread
From: gregkh @ 2019-07-11 11:35 UTC (permalink / raw)
  To: sukhomlinov, dianders, jarkko.sakkinen; +Cc: stable


The patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From db4d8cb9c9f2af71c4d087817160d866ed572cc9 Mon Sep 17 00:00:00 2001
From: Vadim Sukhomlinov <sukhomlinov@google.com>
Date: Mon, 10 Jun 2019 15:01:18 -0700
Subject: [PATCH] tpm: Fix TPM 1.2 Shutdown sequence to prevent future TPM
 operations

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 <sukhomlinov@google.com>
[dianders: resolved merge conflicts with mainline]
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>

diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c
index 90325e1749fb..d47ad10a35fe 100644
--- a/drivers/char/tpm/tpm-chip.c
+++ b/drivers/char/tpm/tpm-chip.c
@@ -289,15 +289,15 @@ static int tpm_class_shutdown(struct device *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;
 }


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: FAILED: patch "[PATCH] tpm: Fix TPM 1.2 Shutdown sequence to prevent future TPM" failed to apply to 4.19-stable tree
  2019-07-11 11:35 FAILED: patch "[PATCH] tpm: Fix TPM 1.2 Shutdown sequence to prevent future TPM" failed to apply to 4.19-stable tree gregkh
@ 2019-07-11 16:30 ` Doug Anderson
  2019-07-11 18:17   ` Jarkko Sakkinen
  0 siblings, 1 reply; 5+ messages in thread
From: Doug Anderson @ 2019-07-11 16:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Vadim Sukhomlinov, Jarkko Sakkinen, # 4.0+

Hi,

On Thu, Jul 11, 2019 at 4:35 AM <gregkh@linuxfoundation.org> wrote:
>
>
> The patch below does not apply to the 4.19-stable tree.
> If someone wants it applied there, or to any other stable or longterm
> tree, then please email the backport, including the original git commit
> id to <stable@vger.kernel.org>.
>
> thanks,
>
> greg k-h
>
> ------------------ original commit in Linus's tree ------------------
>
> From db4d8cb9c9f2af71c4d087817160d866ed572cc9 Mon Sep 17 00:00:00 2001
> From: Vadim Sukhomlinov <sukhomlinov@google.com>
> Date: Mon, 10 Jun 2019 15:01:18 -0700
> Subject: [PATCH] tpm: Fix TPM 1.2 Shutdown sequence to prevent future TPM
>  operations

Posted at:

https://lkml.kernel.org/r/20190711162919.23813-1-dianders@chromium.org

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: FAILED: patch "[PATCH] tpm: Fix TPM 1.2 Shutdown sequence to prevent future TPM" failed to apply to 4.19-stable tree
  2019-07-11 16:30 ` Doug Anderson
@ 2019-07-11 18:17   ` Jarkko Sakkinen
  2019-07-11 18:49     ` Doug Anderson
  0 siblings, 1 reply; 5+ messages in thread
From: Jarkko Sakkinen @ 2019-07-11 18:17 UTC (permalink / raw)
  To: Doug Anderson; +Cc: Greg Kroah-Hartman, Vadim Sukhomlinov, # 4.0+

On Thu, Jul 11, 2019 at 09:30:25AM -0700, Doug Anderson wrote:
> Hi,
> 
> On Thu, Jul 11, 2019 at 4:35 AM <gregkh@linuxfoundation.org> wrote:
> >
> >
> > The patch below does not apply to the 4.19-stable tree.
> > If someone wants it applied there, or to any other stable or longterm
> > tree, then please email the backport, including the original git commit
> > id to <stable@vger.kernel.org>.
> >
> > thanks,
> >
> > greg k-h
> >
> > ------------------ original commit in Linus's tree ------------------
> >
> > From db4d8cb9c9f2af71c4d087817160d866ed572cc9 Mon Sep 17 00:00:00 2001
> > From: Vadim Sukhomlinov <sukhomlinov@google.com>
> > Date: Mon, 10 Jun 2019 15:01:18 -0700
> > Subject: [PATCH] tpm: Fix TPM 1.2 Shutdown sequence to prevent future TPM
> >  operations
> 
> Posted at:
> 
> https://lkml.kernel.org/r/20190711162919.23813-1-dianders@chromium.org

Thank you! I usually end up taking care of these myself :-) A rare
occasion. Does this also address 4.4, 4.9 and 4.14 or do they still
need backports of their own?

/Jarkko

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: FAILED: patch "[PATCH] tpm: Fix TPM 1.2 Shutdown sequence to prevent future TPM" failed to apply to 4.19-stable tree
  2019-07-11 18:17   ` Jarkko Sakkinen
@ 2019-07-11 18:49     ` Doug Anderson
  2019-07-12  2:57       ` Jarkko Sakkinen
  0 siblings, 1 reply; 5+ messages in thread
From: Doug Anderson @ 2019-07-11 18:49 UTC (permalink / raw)
  To: Jarkko Sakkinen; +Cc: Greg Kroah-Hartman, Vadim Sukhomlinov, # 4.0+

Hi,

On Thu, Jul 11, 2019 at 11:17 AM Jarkko Sakkinen
<jarkko.sakkinen@linux.intel.com> wrote:
>
> On Thu, Jul 11, 2019 at 09:30:25AM -0700, Doug Anderson wrote:
> > Hi,
> >
> > On Thu, Jul 11, 2019 at 4:35 AM <gregkh@linuxfoundation.org> wrote:
> > >
> > >
> > > The patch below does not apply to the 4.19-stable tree.
> > > If someone wants it applied there, or to any other stable or longterm
> > > tree, then please email the backport, including the original git commit
> > > id to <stable@vger.kernel.org>.
> > >
> > > thanks,
> > >
> > > greg k-h
> > >
> > > ------------------ original commit in Linus's tree ------------------
> > >
> > > From db4d8cb9c9f2af71c4d087817160d866ed572cc9 Mon Sep 17 00:00:00 2001
> > > From: Vadim Sukhomlinov <sukhomlinov@google.com>
> > > Date: Mon, 10 Jun 2019 15:01:18 -0700
> > > Subject: [PATCH] tpm: Fix TPM 1.2 Shutdown sequence to prevent future TPM
> > >  operations
> >
> > Posted at:
> >
> > https://lkml.kernel.org/r/20190711162919.23813-1-dianders@chromium.org
>
> Thank you! I usually end up taking care of these myself :-) A rare
> occasion. Does this also address 4.4, 4.9 and 4.14 or do they still
> need backports of their own?

In Chrome OS we have the same solution for 4.14.

This patch will _definitely_ not apply cleanly for 4.4.  Not sure what
the best course of action is there, but in the "after the cut" notes
in my post I talk about it a little bit.

On 4.9 things look similar-ish, but I don't know quite enough to know
if it will work well there.

(all of this in the context that apparently some extra locking patches
even for 4.14 and 4.19--see the thread in response to my posted
patch).


-Doug

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: FAILED: patch "[PATCH] tpm: Fix TPM 1.2 Shutdown sequence to prevent future TPM" failed to apply to 4.19-stable tree
  2019-07-11 18:49     ` Doug Anderson
@ 2019-07-12  2:57       ` Jarkko Sakkinen
  0 siblings, 0 replies; 5+ messages in thread
From: Jarkko Sakkinen @ 2019-07-12  2:57 UTC (permalink / raw)
  To: Doug Anderson; +Cc: Greg Kroah-Hartman, Vadim Sukhomlinov, # 4.0+

On Thu, Jul 11, 2019 at 11:49:10AM -0700, Doug Anderson wrote:
> Hi,
> 
> On Thu, Jul 11, 2019 at 11:17 AM Jarkko Sakkinen
> <jarkko.sakkinen@linux.intel.com> wrote:
> >
> > On Thu, Jul 11, 2019 at 09:30:25AM -0700, Doug Anderson wrote:
> > > Hi,
> > >
> > > On Thu, Jul 11, 2019 at 4:35 AM <gregkh@linuxfoundation.org> wrote:
> > > >
> > > >
> > > > The patch below does not apply to the 4.19-stable tree.
> > > > If someone wants it applied there, or to any other stable or longterm
> > > > tree, then please email the backport, including the original git commit
> > > > id to <stable@vger.kernel.org>.
> > > >
> > > > thanks,
> > > >
> > > > greg k-h
> > > >
> > > > ------------------ original commit in Linus's tree ------------------
> > > >
> > > > From db4d8cb9c9f2af71c4d087817160d866ed572cc9 Mon Sep 17 00:00:00 2001
> > > > From: Vadim Sukhomlinov <sukhomlinov@google.com>
> > > > Date: Mon, 10 Jun 2019 15:01:18 -0700
> > > > Subject: [PATCH] tpm: Fix TPM 1.2 Shutdown sequence to prevent future TPM
> > > >  operations
> > >
> > > Posted at:
> > >
> > > https://lkml.kernel.org/r/20190711162919.23813-1-dianders@chromium.org
> >
> > Thank you! I usually end up taking care of these myself :-) A rare
> > occasion. Does this also address 4.4, 4.9 and 4.14 or do they still
> > need backports of their own?
> 
> In Chrome OS we have the same solution for 4.14.
> 
> This patch will _definitely_ not apply cleanly for 4.4.  Not sure what
> the best course of action is there, but in the "after the cut" notes
> in my post I talk about it a little bit.
> 
> On 4.9 things look similar-ish, but I don't know quite enough to know
> if it will work well there.
> 
> (all of this in the context that apparently some extra locking patches
> even for 4.14 and 4.19--see the thread in response to my posted
> patch).

OK, I'll look at those when I come back from leave after two weeks.

/Jarkko

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-07-12  2:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-11 11:35 FAILED: patch "[PATCH] tpm: Fix TPM 1.2 Shutdown sequence to prevent future TPM" failed to apply to 4.19-stable tree gregkh
2019-07-11 16:30 ` Doug Anderson
2019-07-11 18:17   ` Jarkko Sakkinen
2019-07-11 18:49     ` Doug Anderson
2019-07-12  2:57       ` Jarkko Sakkinen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.