* [PATCH AUTOSEL 4.19 062/167] tpm: Fix some name collisions with drivers/char/tpm.h [not found] <20190903162519.7136-1-sashal@kernel.org> @ 2019-09-03 16:23 ` Sasha Levin 2019-09-03 16:24 ` [PATCH AUTOSEL 4.19 126/167] tpm: Fix TPM 1.2 Shutdown sequence to prevent future TPM operations Sasha Levin 1 sibling, 0 replies; 11+ messages in thread From: Sasha Levin @ 2019-09-03 16:23 UTC (permalink / raw) To: linux-kernel, stable; +Cc: Jarkko Sakkinen, Sasha Levin, linux-integrity From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> [ Upstream commit 8ab547a2dcfac6ec184a5e036e1093eb3f7a215c ] * Rename TPM_BUFSIZE defined in drivers/char/tpm/st33zp24/st33zp24.h to ST33ZP24_BUFSIZE. * Rename TPM_BUFSIZE defined in drivers/char/tpm/tpm_i2c_infineon.c to TPM_I2C_INFINEON_BUFSIZE. * Rename TPM_RETRY in tpm_i2c_nuvoton to TPM_I2C_RETRIES. * Remove TPM_HEADER_SIZE from tpm_i2c_nuvoton. Cc: stable@vger.kernel.org Fixes: bf38b8710892 ("tpm/tpm_i2c_stm_st33: Split tpm_i2c_tpm_st33 in 2 layers (core + phy)") Fixes: aad628c1d91a ("char/tpm: Add new driver for Infineon I2C TIS TPM") Fixes: 32d33b29ba07 ("TPM: Retry SaveState command in suspend path") Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org> --- drivers/char/tpm/st33zp24/i2c.c | 2 +- drivers/char/tpm/st33zp24/spi.c | 2 +- drivers/char/tpm/st33zp24/st33zp24.h | 4 ++-- drivers/char/tpm/tpm_i2c_infineon.c | 15 ++++++++------- drivers/char/tpm/tpm_i2c_nuvoton.c | 16 +++++++--------- 5 files changed, 19 insertions(+), 20 deletions(-) diff --git a/drivers/char/tpm/st33zp24/i2c.c b/drivers/char/tpm/st33zp24/i2c.c index be5d1abd3e8ef..8390c5b54c3be 100644 --- a/drivers/char/tpm/st33zp24/i2c.c +++ b/drivers/char/tpm/st33zp24/i2c.c @@ -33,7 +33,7 @@ struct st33zp24_i2c_phy { struct i2c_client *client; - u8 buf[TPM_BUFSIZE + 1]; + u8 buf[ST33ZP24_BUFSIZE + 1]; int io_lpcpd; }; diff --git a/drivers/char/tpm/st33zp24/spi.c b/drivers/char/tpm/st33zp24/spi.c index d7909ab287a85..ff019a1e3c68f 100644 --- a/drivers/char/tpm/st33zp24/spi.c +++ b/drivers/char/tpm/st33zp24/spi.c @@ -63,7 +63,7 @@ * some latency byte before the answer is available (max 15). * We have 2048 + 1024 + 15. */ -#define ST33ZP24_SPI_BUFFER_SIZE (TPM_BUFSIZE + (TPM_BUFSIZE / 2) +\ +#define ST33ZP24_SPI_BUFFER_SIZE (ST33ZP24_BUFSIZE + (ST33ZP24_BUFSIZE / 2) +\ MAX_SPI_LATENCY) diff --git a/drivers/char/tpm/st33zp24/st33zp24.h b/drivers/char/tpm/st33zp24/st33zp24.h index 6f4a4198af6aa..20da0a84988d6 100644 --- a/drivers/char/tpm/st33zp24/st33zp24.h +++ b/drivers/char/tpm/st33zp24/st33zp24.h @@ -18,8 +18,8 @@ #ifndef __LOCAL_ST33ZP24_H__ #define __LOCAL_ST33ZP24_H__ -#define TPM_WRITE_DIRECTION 0x80 -#define TPM_BUFSIZE 2048 +#define TPM_WRITE_DIRECTION 0x80 +#define ST33ZP24_BUFSIZE 2048 struct st33zp24_dev { struct tpm_chip *chip; diff --git a/drivers/char/tpm/tpm_i2c_infineon.c b/drivers/char/tpm/tpm_i2c_infineon.c index 977fd42daa1b1..3b4e9672ff6cd 100644 --- a/drivers/char/tpm/tpm_i2c_infineon.c +++ b/drivers/char/tpm/tpm_i2c_infineon.c @@ -26,8 +26,7 @@ #include <linux/wait.h> #include "tpm.h" -/* max. buffer size supported by our TPM */ -#define TPM_BUFSIZE 1260 +#define TPM_I2C_INFINEON_BUFSIZE 1260 /* max. number of iterations after I2C NAK */ #define MAX_COUNT 3 @@ -63,11 +62,13 @@ enum i2c_chip_type { UNKNOWN, }; -/* Structure to store I2C TPM specific stuff */ struct tpm_inf_dev { struct i2c_client *client; int locality; - u8 buf[TPM_BUFSIZE + sizeof(u8)]; /* max. buffer size + addr */ + /* In addition to the data itself, the buffer must fit the 7-bit I2C + * address and the direction bit. + */ + u8 buf[TPM_I2C_INFINEON_BUFSIZE + 1]; struct tpm_chip *chip; enum i2c_chip_type chip_type; unsigned int adapterlimit; @@ -219,7 +220,7 @@ static int iic_tpm_write_generic(u8 addr, u8 *buffer, size_t len, .buf = tpm_dev.buf }; - if (len > TPM_BUFSIZE) + if (len > TPM_I2C_INFINEON_BUFSIZE) return -EINVAL; if (!tpm_dev.client->adapter->algo->master_xfer) @@ -527,8 +528,8 @@ static int tpm_tis_i2c_send(struct tpm_chip *chip, u8 *buf, size_t len) u8 retries = 0; u8 sts = TPM_STS_GO; - if (len > TPM_BUFSIZE) - return -E2BIG; /* command is too long for our tpm, sorry */ + if (len > TPM_I2C_INFINEON_BUFSIZE) + return -E2BIG; if (request_locality(chip, 0) < 0) return -EBUSY; diff --git a/drivers/char/tpm/tpm_i2c_nuvoton.c b/drivers/char/tpm/tpm_i2c_nuvoton.c index b8defdfdf2dc6..2803080097841 100644 --- a/drivers/char/tpm/tpm_i2c_nuvoton.c +++ b/drivers/char/tpm/tpm_i2c_nuvoton.c @@ -35,14 +35,12 @@ #include "tpm.h" /* I2C interface offsets */ -#define TPM_STS 0x00 -#define TPM_BURST_COUNT 0x01 -#define TPM_DATA_FIFO_W 0x20 -#define TPM_DATA_FIFO_R 0x40 -#define TPM_VID_DID_RID 0x60 -/* TPM command header size */ -#define TPM_HEADER_SIZE 10 -#define TPM_RETRY 5 +#define TPM_STS 0x00 +#define TPM_BURST_COUNT 0x01 +#define TPM_DATA_FIFO_W 0x20 +#define TPM_DATA_FIFO_R 0x40 +#define TPM_VID_DID_RID 0x60 +#define TPM_I2C_RETRIES 5 /* * I2C bus device maximum buffer size w/o counting I2C address or command * i.e. max size required for I2C write is 34 = addr, command, 32 bytes data @@ -292,7 +290,7 @@ static int i2c_nuvoton_recv(struct tpm_chip *chip, u8 *buf, size_t count) dev_err(dev, "%s() count < header size\n", __func__); return -EIO; } - for (retries = 0; retries < TPM_RETRY; retries++) { + for (retries = 0; retries < TPM_I2C_RETRIES; retries++) { if (retries > 0) { /* if this is not the first trial, set responseRetry */ i2c_nuvoton_write_status(client, -- 2.20.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH AUTOSEL 4.19 126/167] tpm: Fix TPM 1.2 Shutdown sequence to prevent future TPM operations [not found] <20190903162519.7136-1-sashal@kernel.org> 2019-09-03 16:23 ` [PATCH AUTOSEL 4.19 062/167] tpm: Fix some name collisions with drivers/char/tpm.h Sasha Levin @ 2019-09-03 16:24 ` Sasha Levin 2019-09-03 16:39 ` Doug Anderson 1 sibling, 1 reply; 11+ messages in thread From: Sasha Levin @ 2019-09-03 16:24 UTC (permalink / raw) To: linux-kernel, stable Cc: Vadim Sukhomlinov, Douglas Anderson, Jarkko Sakkinen, Sasha Levin, linux-integrity From: Vadim Sukhomlinov <sukhomlinov@google.com> [ Upstream commit db4d8cb9c9f2af71c4d087817160d866ed572cc9 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org> --- drivers/char/tpm/tpm-chip.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c index 46caadca916a0..0b01eb7b14e53 100644 --- a/drivers/char/tpm/tpm-chip.c +++ b/drivers/char/tpm/tpm-chip.c @@ -187,12 +187,13 @@ 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); tpm2_shutdown(chip, TPM2_SU_CLEAR); chip->ops = NULL; - up_write(&chip->ops_sem); } + chip->ops = NULL; + up_write(&chip->ops_sem); return 0; } -- 2.20.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH AUTOSEL 4.19 126/167] tpm: Fix TPM 1.2 Shutdown sequence to prevent future TPM operations 2019-09-03 16:24 ` [PATCH AUTOSEL 4.19 126/167] tpm: Fix TPM 1.2 Shutdown sequence to prevent future TPM operations Sasha Levin @ 2019-09-03 16:39 ` Doug Anderson 2019-09-03 16:53 ` Jerry Snitselaar 2019-09-07 16:55 ` Jarkko Sakkinen 0 siblings, 2 replies; 11+ messages in thread From: Doug Anderson @ 2019-09-03 16:39 UTC (permalink / raw) To: Sasha Levin, Jarkko Sakkinen Cc: LKML, # 4.0+, Vadim Sukhomlinov, linux-integrity, Jason Gunthorpe Hi, On Tue, Sep 3, 2019 at 9:28 AM Sasha Levin <sashal@kernel.org> wrote: > > From: Vadim Sukhomlinov <sukhomlinov@google.com> > > [ Upstream commit db4d8cb9c9f2af71c4d087817160d866ed572cc9 ] > > 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> > Signed-off-by: Sasha Levin <sashal@kernel.org> > --- > drivers/char/tpm/tpm-chip.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) Jarkko: did you deal with the issues that came up in response to my post? Are you happy with this going into 4.19 stable at this point? I notice this has your Signed-off-by so maybe? -Doug ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH AUTOSEL 4.19 126/167] tpm: Fix TPM 1.2 Shutdown sequence to prevent future TPM operations 2019-09-03 16:39 ` Doug Anderson @ 2019-09-03 16:53 ` Jerry Snitselaar 2019-09-03 19:43 ` Sasha Levin 2019-09-07 16:55 ` Jarkko Sakkinen 1 sibling, 1 reply; 11+ messages in thread From: Jerry Snitselaar @ 2019-09-03 16:53 UTC (permalink / raw) To: Doug Anderson Cc: Sasha Levin, Jarkko Sakkinen, LKML, # 4.0+, Vadim Sukhomlinov, linux-integrity, Jason Gunthorpe On Tue Sep 03 19, Doug Anderson wrote: >Hi, > >On Tue, Sep 3, 2019 at 9:28 AM Sasha Levin <sashal@kernel.org> wrote: >> >> From: Vadim Sukhomlinov <sukhomlinov@google.com> >> >> [ Upstream commit db4d8cb9c9f2af71c4d087817160d866ed572cc9 ] >> >> 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> >> Signed-off-by: Sasha Levin <sashal@kernel.org> >> --- >> drivers/char/tpm/tpm-chip.c | 5 +++-- >> 1 file changed, 3 insertions(+), 2 deletions(-) > >Jarkko: did you deal with the issues that came up in response to my >post? Are you happy with this going into 4.19 stable at this point? >I notice this has your Signed-off-by so maybe? > I think that is just the signed-off-by chain coming from the upstream patch. Jarkko mentioned getting to the backports after Linux Plumbers, which is next week. >-Doug ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH AUTOSEL 4.19 126/167] tpm: Fix TPM 1.2 Shutdown sequence to prevent future TPM operations 2019-09-03 16:53 ` Jerry Snitselaar @ 2019-09-03 19:43 ` Sasha Levin 2019-09-07 18:55 ` Jarkko Sakkinen 0 siblings, 1 reply; 11+ messages in thread From: Sasha Levin @ 2019-09-03 19:43 UTC (permalink / raw) To: Doug Anderson, Jarkko Sakkinen, LKML, # 4.0+, Vadim Sukhomlinov, linux-integrity, Jason Gunthorpe On Tue, Sep 03, 2019 at 09:53:46AM -0700, Jerry Snitselaar wrote: >On Tue Sep 03 19, Doug Anderson wrote: >>Hi, >> >>On Tue, Sep 3, 2019 at 9:28 AM Sasha Levin <sashal@kernel.org> wrote: >>> >>>From: Vadim Sukhomlinov <sukhomlinov@google.com> >>> >>>[ Upstream commit db4d8cb9c9f2af71c4d087817160d866ed572cc9 ] >>> >>>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> >>>Signed-off-by: Sasha Levin <sashal@kernel.org> >>>--- >>> drivers/char/tpm/tpm-chip.c | 5 +++-- >>> 1 file changed, 3 insertions(+), 2 deletions(-) >> >>Jarkko: did you deal with the issues that came up in response to my >>post? Are you happy with this going into 4.19 stable at this point? >>I notice this has your Signed-off-by so maybe? >> > >I think that is just the signed-off-by chain coming from the upstream patch. >Jarkko mentioned getting to the backports after Linux Plumbers, which is next week. Right. I gave a go at backporting a few patches and this happens to be one of them. It will be a while before it goes in a stable tree (probably way after after LPC). -- Thanks, Sasha ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH AUTOSEL 4.19 126/167] tpm: Fix TPM 1.2 Shutdown sequence to prevent future TPM operations 2019-09-03 19:43 ` Sasha Levin @ 2019-09-07 18:55 ` Jarkko Sakkinen 2019-09-07 22:04 ` Sasha Levin 0 siblings, 1 reply; 11+ messages in thread From: Jarkko Sakkinen @ 2019-09-07 18:55 UTC (permalink / raw) To: Sasha Levin, Doug Anderson, LKML, # 4.0+, Vadim Sukhomlinov, linux-integrity, Jason Gunthorpe On Tue, 2019-09-03 at 15:43 -0400, Sasha Levin wrote: > Right. I gave a go at backporting a few patches and this happens to be > one of them. It will be a while before it goes in a stable tree > (probably way after after LPC). It *semantically* depends on db4d8cb9c9f2 ("tpm: use tpm_try_get_ops() in tpm-sysfs.c.") I.e. can cause crashes without the above patch. As a code change your patch is fine but it needs the above patch backported to work in stable manner. So... either I can backport that one (because ultimately I have responsibility to do that as the maintainer) but if you want to finish this one that is what you need to backport in addition and then it should be fine. /Jarkko ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH AUTOSEL 4.19 126/167] tpm: Fix TPM 1.2 Shutdown sequence to prevent future TPM operations 2019-09-07 18:55 ` Jarkko Sakkinen @ 2019-09-07 22:04 ` Sasha Levin 2019-09-09 16:28 ` Jarkko Sakkinen 0 siblings, 1 reply; 11+ messages in thread From: Sasha Levin @ 2019-09-07 22:04 UTC (permalink / raw) To: Jarkko Sakkinen Cc: Doug Anderson, LKML, # 4.0+, Vadim Sukhomlinov, linux-integrity, Jason Gunthorpe On Sat, Sep 07, 2019 at 09:55:18PM +0300, Jarkko Sakkinen wrote: >On Tue, 2019-09-03 at 15:43 -0400, Sasha Levin wrote: >> Right. I gave a go at backporting a few patches and this happens to be >> one of them. It will be a while before it goes in a stable tree >> (probably way after after LPC). > >It *semantically* depends on > >db4d8cb9c9f2 ("tpm: use tpm_try_get_ops() in tpm-sysfs.c.") > >I.e. can cause crashes without the above patch. As a code change your >patch is fine but it needs the above patch backported to work in stable >manner. > >So... either I can backport that one (because ultimately I have >responsibility to do that as the maintainer) but if you want to finish >this one that is what you need to backport in addition and then it >should be fine. If you're ok with the backport of this commit, I can just add db4d8cb9c9f2 on top. -- Thanks, Sasha ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH AUTOSEL 4.19 126/167] tpm: Fix TPM 1.2 Shutdown sequence to prevent future TPM operations 2019-09-07 22:04 ` Sasha Levin @ 2019-09-09 16:28 ` Jarkko Sakkinen 2019-09-11 7:56 ` Sasha Levin 2019-09-15 15:19 ` Jarkko Sakkinen 0 siblings, 2 replies; 11+ messages in thread From: Jarkko Sakkinen @ 2019-09-09 16:28 UTC (permalink / raw) To: Sasha Levin Cc: Doug Anderson, LKML, # 4.0+, Vadim Sukhomlinov, linux-integrity, Jason Gunthorpe On Sat, Sep 07, 2019 at 06:04:48PM -0400, Sasha Levin wrote: > On Sat, Sep 07, 2019 at 09:55:18PM +0300, Jarkko Sakkinen wrote: > > On Tue, 2019-09-03 at 15:43 -0400, Sasha Levin wrote: > > > Right. I gave a go at backporting a few patches and this happens to be > > > one of them. It will be a while before it goes in a stable tree > > > (probably way after after LPC). > > > > It *semantically* depends on > > > > db4d8cb9c9f2 ("tpm: use tpm_try_get_ops() in tpm-sysfs.c.") > > > > I.e. can cause crashes without the above patch. As a code change your > > patch is fine but it needs the above patch backported to work in stable > > manner. > > > > So... either I can backport that one (because ultimately I have > > responsibility to do that as the maintainer) but if you want to finish > > this one that is what you need to backport in addition and then it > > should be fine. > > If you're ok with the backport of this commit, I can just add > db4d8cb9c9f2 on top. Sure, I've already gave my promise to do that :-) /Jarkko ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH AUTOSEL 4.19 126/167] tpm: Fix TPM 1.2 Shutdown sequence to prevent future TPM operations 2019-09-09 16:28 ` Jarkko Sakkinen @ 2019-09-11 7:56 ` Sasha Levin 2019-09-15 15:19 ` Jarkko Sakkinen 1 sibling, 0 replies; 11+ messages in thread From: Sasha Levin @ 2019-09-11 7:56 UTC (permalink / raw) To: Jarkko Sakkinen Cc: Doug Anderson, LKML, # 4.0+, Vadim Sukhomlinov, linux-integrity, Jason Gunthorpe On Mon, Sep 09, 2019 at 05:28:08PM +0100, Jarkko Sakkinen wrote: >On Sat, Sep 07, 2019 at 06:04:48PM -0400, Sasha Levin wrote: >> On Sat, Sep 07, 2019 at 09:55:18PM +0300, Jarkko Sakkinen wrote: >> > On Tue, 2019-09-03 at 15:43 -0400, Sasha Levin wrote: >> > > Right. I gave a go at backporting a few patches and this happens to be >> > > one of them. It will be a while before it goes in a stable tree >> > > (probably way after after LPC). >> > >> > It *semantically* depends on >> > >> > db4d8cb9c9f2 ("tpm: use tpm_try_get_ops() in tpm-sysfs.c.") >> > >> > I.e. can cause crashes without the above patch. As a code change your >> > patch is fine but it needs the above patch backported to work in stable >> > manner. >> > >> > So... either I can backport that one (because ultimately I have >> > responsibility to do that as the maintainer) but if you want to finish >> > this one that is what you need to backport in addition and then it >> > should be fine. >> >> If you're ok with the backport of this commit, I can just add >> db4d8cb9c9f2 on top. > >Sure, I've already gave my promise to do that :-) I think that the dependency in question is actually: 2677ca98ae377 ("tpm: use tpm_try_get_ops() in tpm-sysfs.c.") Which is tricky to backport. I think I'll drop this patch for now and wait for your backport instead. -- Thanks, Sasha ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH AUTOSEL 4.19 126/167] tpm: Fix TPM 1.2 Shutdown sequence to prevent future TPM operations 2019-09-09 16:28 ` Jarkko Sakkinen 2019-09-11 7:56 ` Sasha Levin @ 2019-09-15 15:19 ` Jarkko Sakkinen 1 sibling, 0 replies; 11+ messages in thread From: Jarkko Sakkinen @ 2019-09-15 15:19 UTC (permalink / raw) To: Sasha Levin Cc: Doug Anderson, LKML, # 4.0+, Vadim Sukhomlinov, linux-integrity, Jason Gunthorpe On Mon, Sep 09, 2019 at 05:28:08PM +0100, Jarkko Sakkinen wrote: > On Sat, Sep 07, 2019 at 06:04:48PM -0400, Sasha Levin wrote: > > On Sat, Sep 07, 2019 at 09:55:18PM +0300, Jarkko Sakkinen wrote: > > > On Tue, 2019-09-03 at 15:43 -0400, Sasha Levin wrote: > > > > Right. I gave a go at backporting a few patches and this happens to be > > > > one of them. It will be a while before it goes in a stable tree > > > > (probably way after after LPC). > > > > > > It *semantically* depends on > > > > > > db4d8cb9c9f2 ("tpm: use tpm_try_get_ops() in tpm-sysfs.c.") > > > > > > I.e. can cause crashes without the above patch. As a code change your > > > patch is fine but it needs the above patch backported to work in stable > > > manner. > > > > > > So... either I can backport that one (because ultimately I have > > > responsibility to do that as the maintainer) but if you want to finish > > > this one that is what you need to backport in addition and then it > > > should be fine. > > > > If you're ok with the backport of this commit, I can just add > > db4d8cb9c9f2 on top. > > Sure, I've already gave my promise to do that :-) I ended up with: db4d8cb9c9f2 tpm: Fix TPM 1.2 Shutdown sequence to prevent future TPM operations 2677ca98ae37 tpm: use tpm_try_get_ops() in tpm-sysfs.c. da379f3c1db0 tpm: migrate pubek_show to struct tpm_buf Since some time has passed I'l just restate that the reason for backporting 2677ca98ae37 was that tpm_class_shutdown() could pull carpet under the TPM 1.2 code. tpm_try_get_ops() makes sure that read lock is taken and chip->ops is not NULL if it successfully returns. Still need to test the patches with TPM 1.2 hardware before I can send them. /Jarkko ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH AUTOSEL 4.19 126/167] tpm: Fix TPM 1.2 Shutdown sequence to prevent future TPM operations 2019-09-03 16:39 ` Doug Anderson 2019-09-03 16:53 ` Jerry Snitselaar @ 2019-09-07 16:55 ` Jarkko Sakkinen 1 sibling, 0 replies; 11+ messages in thread From: Jarkko Sakkinen @ 2019-09-07 16:55 UTC (permalink / raw) To: Doug Anderson, Sasha Levin Cc: LKML, # 4.0+, Vadim Sukhomlinov, linux-integrity, Jason Gunthorpe On Tue, 2019-09-03 at 09:39 -0700, Doug Anderson wrote: > Hi, > > On Tue, Sep 3, 2019 at 9:28 AM Sasha Levin <sashal@kernel.org> wrote: > > From: Vadim Sukhomlinov <sukhomlinov@google.com> > > > > [ Upstream commit db4d8cb9c9f2af71c4d087817160d866ed572cc9 ] > > > > 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> > > Signed-off-by: Sasha Levin <sashal@kernel.org> > > --- > > drivers/char/tpm/tpm-chip.c | 5 +++-- > > 1 file changed, 3 insertions(+), 2 deletions(-) > > Jarkko: did you deal with the issues that came up in response to my > post? Are you happy with this going into 4.19 stable at this point? > I notice this has your Signed-off-by so maybe? No I have not dealt with the issues yet. The last thing I've said about this is: https://lore.kernel.org/stable/20190805210501.vjtmwgxjg334vtnc@linux.intel.com/ I was actually going to look into this during the plane trip to Lissabon tomorrow morning. I have in mind that this needs to be backported first: db4d8cb9c9f2 ("tpm: use tpm_try_get_ops() in tpm-sysfs.c.") /Jarkko ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2019-09-15 15:19 UTC | newest] Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <20190903162519.7136-1-sashal@kernel.org> 2019-09-03 16:23 ` [PATCH AUTOSEL 4.19 062/167] tpm: Fix some name collisions with drivers/char/tpm.h Sasha Levin 2019-09-03 16:24 ` [PATCH AUTOSEL 4.19 126/167] tpm: Fix TPM 1.2 Shutdown sequence to prevent future TPM operations Sasha Levin 2019-09-03 16:39 ` Doug Anderson 2019-09-03 16:53 ` Jerry Snitselaar 2019-09-03 19:43 ` Sasha Levin 2019-09-07 18:55 ` Jarkko Sakkinen 2019-09-07 22:04 ` Sasha Levin 2019-09-09 16:28 ` Jarkko Sakkinen 2019-09-11 7:56 ` Sasha Levin 2019-09-15 15:19 ` Jarkko Sakkinen 2019-09-07 16:55 ` Jarkko Sakkinen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).