stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tpm/tpm_i2c_atmel: Return -E2BIG when the transfer is incomplete
@ 2019-04-23 12:44 Jarkko Sakkinen
  0 siblings, 0 replies; 5+ messages in thread
From: Jarkko Sakkinen @ 2019-04-23 12:44 UTC (permalink / raw)
  To: stable; +Cc: Jarkko Sakkinen, Stefan Berger, Jerry Snitselaar

commit 442601e87a4769a8daba4976ec3afa5222ca211d upstream

Return -E2BIG when the transfer is incomplete. The upper layer does
not retry, so not doing that is incorrect behaviour.

Cc: stable@vger.kernel.org
Fixes: a2871c62e186 ("tpm: Add support for Atmel I2C TPMs")
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>
---
backport v4.4.178
 drivers/char/tpm/tpm_i2c_atmel.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/char/tpm/tpm_i2c_atmel.c b/drivers/char/tpm/tpm_i2c_atmel.c
index 95ce2e9ccdc6..cc4e642d3180 100644
--- a/drivers/char/tpm/tpm_i2c_atmel.c
+++ b/drivers/char/tpm/tpm_i2c_atmel.c
@@ -65,7 +65,15 @@ static int i2c_atmel_send(struct tpm_chip *chip, u8 *buf, size_t len)
 	dev_dbg(&chip->dev,
 		"%s(buf=%*ph len=%0zx) -> sts=%d\n", __func__,
 		(int)min_t(size_t, 64, len), buf, len, status);
-	return status;
+
+	if (status < 0)
+		return status;
+
+	/* The upper layer does not support incomplete sends. */
+	if (status != len)
+		return -E2BIG;
+
+	return 0;
 }
 
 static int i2c_atmel_recv(struct tpm_chip *chip, u8 *buf, size_t count)
-- 
2.20.1


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

* Re: [PATCH] tpm/tpm_i2c_atmel: Return -E2BIG when the transfer is incomplete
  2019-04-23 15:03 ` Sasha Levin
@ 2019-05-02  7:07   ` Jarkko Sakkinen
  0 siblings, 0 replies; 5+ messages in thread
From: Jarkko Sakkinen @ 2019-05-02  7:07 UTC (permalink / raw)
  To: Sasha Levin; +Cc: stable, Stefan Berger, Jerry Snitselaar

On Tue, Apr 23, 2019 at 11:03:07AM -0400, Sasha Levin wrote:
> On Tue, Apr 23, 2019 at 03:43:35PM +0300, Jarkko Sakkinen wrote:
> > commit 442601e87a4769a8daba4976ec3afa5222ca211d upstream
> > 
> > Return -E2BIG when the transfer is incomplete. The upper layer does
> > not retry, so not doing that is incorrect behaviour.
> > 
> > Cc: stable@vger.kernel.org
> > Fixes: a2871c62e186 ("tpm: Add support for Atmel I2C TPMs")
> > Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
> > Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
> > Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>
> 
> Okay, between the upstream version and your backports we have this fix
> on all branches, thank you!

Awesome!

/Jarkko

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

* Re: [PATCH] tpm/tpm_i2c_atmel: Return -E2BIG when the transfer is incomplete
  2019-04-23 12:43 Jarkko Sakkinen
@ 2019-04-23 15:03 ` Sasha Levin
  2019-05-02  7:07   ` Jarkko Sakkinen
  0 siblings, 1 reply; 5+ messages in thread
From: Sasha Levin @ 2019-04-23 15:03 UTC (permalink / raw)
  To: Jarkko Sakkinen; +Cc: stable, Stefan Berger, Jerry Snitselaar

On Tue, Apr 23, 2019 at 03:43:35PM +0300, Jarkko Sakkinen wrote:
>commit 442601e87a4769a8daba4976ec3afa5222ca211d upstream
>
>Return -E2BIG when the transfer is incomplete. The upper layer does
>not retry, so not doing that is incorrect behaviour.
>
>Cc: stable@vger.kernel.org
>Fixes: a2871c62e186 ("tpm: Add support for Atmel I2C TPMs")
>Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
>Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
>Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>

Okay, between the upstream version and your backports we have this fix
on all branches, thank you!

--
Thanks,
Sasha

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

* [PATCH] tpm/tpm_i2c_atmel: Return -E2BIG when the transfer is incomplete
@ 2019-04-23 12:46 Jarkko Sakkinen
  0 siblings, 0 replies; 5+ messages in thread
From: Jarkko Sakkinen @ 2019-04-23 12:46 UTC (permalink / raw)
  To: stable; +Cc: Jarkko Sakkinen, Stefan Berger, Jerry Snitselaar

commit 442601e87a4769a8daba4976ec3afa5222ca211d upstream

Return -E2BIG when the transfer is incomplete. The upper layer does
not retry, so not doing that is incorrect behaviour.

Cc: stable@vger.kernel.org
Fixes: a2871c62e186 ("tpm: Add support for Atmel I2C TPMs")
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>
---
backport v3.18.138
 drivers/char/tpm/tpm_i2c_atmel.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/char/tpm/tpm_i2c_atmel.c b/drivers/char/tpm/tpm_i2c_atmel.c
index 503a85ae176c..0ea430cc606f 100644
--- a/drivers/char/tpm/tpm_i2c_atmel.c
+++ b/drivers/char/tpm/tpm_i2c_atmel.c
@@ -65,7 +65,15 @@ static int i2c_atmel_send(struct tpm_chip *chip, u8 *buf, size_t len)
 	dev_dbg(chip->dev,
 		"%s(buf=%*ph len=%0zx) -> sts=%d\n", __func__,
 		(int)min_t(size_t, 64, len), buf, len, status);
-	return status;
+
+	if (status < 0)
+		return status;
+
+	/* The upper layer does not support incomplete sends. */
+	if (status != len)
+		return -E2BIG;
+
+	return 0;
 }
 
 static int i2c_atmel_recv(struct tpm_chip *chip, u8 *buf, size_t count)
-- 
2.20.1


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

* [PATCH] tpm/tpm_i2c_atmel: Return -E2BIG when the transfer is incomplete
@ 2019-04-23 12:43 Jarkko Sakkinen
  2019-04-23 15:03 ` Sasha Levin
  0 siblings, 1 reply; 5+ messages in thread
From: Jarkko Sakkinen @ 2019-04-23 12:43 UTC (permalink / raw)
  To: stable; +Cc: Jarkko Sakkinen, Stefan Berger, Jerry Snitselaar

commit 442601e87a4769a8daba4976ec3afa5222ca211d upstream

Return -E2BIG when the transfer is incomplete. The upper layer does
not retry, so not doing that is incorrect behaviour.

Cc: stable@vger.kernel.org
Fixes: a2871c62e186 ("tpm: Add support for Atmel I2C TPMs")
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>
---
backport v4.9.99
 drivers/char/tpm/tpm_i2c_atmel.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/char/tpm/tpm_i2c_atmel.c b/drivers/char/tpm/tpm_i2c_atmel.c
index 95ce2e9ccdc6..cc4e642d3180 100644
--- a/drivers/char/tpm/tpm_i2c_atmel.c
+++ b/drivers/char/tpm/tpm_i2c_atmel.c
@@ -65,7 +65,15 @@ static int i2c_atmel_send(struct tpm_chip *chip, u8 *buf, size_t len)
 	dev_dbg(&chip->dev,
 		"%s(buf=%*ph len=%0zx) -> sts=%d\n", __func__,
 		(int)min_t(size_t, 64, len), buf, len, status);
-	return status;
+
+	if (status < 0)
+		return status;
+
+	/* The upper layer does not support incomplete sends. */
+	if (status != len)
+		return -E2BIG;
+
+	return 0;
 }
 
 static int i2c_atmel_recv(struct tpm_chip *chip, u8 *buf, size_t count)
-- 
2.20.1


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

end of thread, other threads:[~2019-05-02  7:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-23 12:44 [PATCH] tpm/tpm_i2c_atmel: Return -E2BIG when the transfer is incomplete Jarkko Sakkinen
  -- strict thread matches above, loose matches on Subject: below --
2019-04-23 12:46 Jarkko Sakkinen
2019-04-23 12:43 Jarkko Sakkinen
2019-04-23 15:03 ` Sasha Levin
2019-05-02  7:07   ` 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).