tpmdd-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] tpm: vtpm_proxy: Suppresse error logging when in closed state
@ 2017-05-25 21:39 Stefan Berger
       [not found] ` <1495748360-26558-1-git-send-email-stefanb-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Berger @ 2017-05-25 21:39 UTC (permalink / raw)
  To: jarkko.sakkinen, tpmdd-devel
  Cc: linux-security-module, linux-kernel, jgunthorpe, Stefan Berger

Suppress the error logging when the core TPM driver sends commands
to the VTPM proxy driver and -EPIPE is returned in case the VTPM
proxy driver is 'closed' (closed anonymous file descriptor).  This
error code is only returned by the send function and by tpm_transmit
when the VTPM proxy driver is being used.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
---
 drivers/char/tpm/tpm-interface.c | 4 ++--
 drivers/char/tpm/tpm2-cmd.c      | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
index d711186..4826fcf 100644
--- a/drivers/char/tpm/tpm-interface.c
+++ b/drivers/char/tpm/tpm-interface.c
@@ -429,11 +429,11 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space,
 		goto out;
 
 	rc = chip->ops->send(chip, (u8 *) buf, count);
-	if (rc < 0) {
+	if (rc < 0 && rc != -EPIPE)
 		dev_err(&chip->dev,
 			"tpm_transmit: tpm_send: error %d\n", rc);
+	if (rc < 0)
 		goto out;
-	}
 
 	if (chip->flags & TPM_CHIP_FLAG_IRQ)
 		goto out_recv;
diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c
index 3ee6883..3a99643 100644
--- a/drivers/char/tpm/tpm2-cmd.c
+++ b/drivers/char/tpm/tpm2-cmd.c
@@ -840,7 +840,7 @@ void tpm2_shutdown(struct tpm_chip *chip, u16 shutdown_type)
 	/* In places where shutdown command is sent there's no much we can do
 	 * except print the error code on a system failure.
 	 */
-	if (rc < 0)
+	if (rc < 0 && rc != -EPIPE)
 		dev_warn(&chip->dev, "transmit returned %d while stopping the TPM",
 			 rc);
 }
-- 
2.4.3


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

* Re: [PATCH v2] tpm: vtpm_proxy: Suppresse error logging when in closed state
       [not found] ` <1495748360-26558-1-git-send-email-stefanb-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
@ 2017-05-25 21:53   ` Joe Perches
  2017-05-25 22:35   ` Jarkko Sakkinen
  1 sibling, 0 replies; 3+ messages in thread
From: Joe Perches @ 2017-05-25 21:53 UTC (permalink / raw)
  To: Stefan Berger, jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA,
	tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: linux-security-module-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Thu, 2017-05-25 at 17:39 -0400, Stefan Berger wrote:
> Suppress the error logging when the core TPM driver sends commands
> to the VTPM proxy driver and -EPIPE is returned in case the VTPM
> proxy driver is 'closed' (closed anonymous file descriptor).  This
> error code is only returned by the send function and by tpm_transmit
> when the VTPM proxy driver is being used.
> 
> Signed-off-by: Stefan Berger <stefanb-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
> ---
>  drivers/char/tpm/tpm-interface.c | 4 ++--
>  drivers/char/tpm/tpm2-cmd.c      | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
> index d711186..4826fcf 100644
> --- a/drivers/char/tpm/tpm-interface.c
> +++ b/drivers/char/tpm/tpm-interface.c
> @@ -429,11 +429,11 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space,
>  		goto out;
>  
>  	rc = chip->ops->send(chip, (u8 *) buf, count);
> -	if (rc < 0) {
> +	if (rc < 0 && rc != -EPIPE)
>  		dev_err(&chip->dev,
>  			"tpm_transmit: tpm_send: error %d\n", rc);
> +	if (rc < 0)
>  		goto out;

Perhaps this would read better as

	if (rc < 0) {
		if (rc != -EPIPE)
			dev_err(etc...);
		goto out;
	}

though for etc, perhaps
			dev_err(&chip->dev, "%s: %tpm_send: error %d\n",
				__func__, rc);

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

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

* Re: [PATCH v2] tpm: vtpm_proxy: Suppresse error logging when in closed state
       [not found] ` <1495748360-26558-1-git-send-email-stefanb-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
  2017-05-25 21:53   ` Joe Perches
@ 2017-05-25 22:35   ` Jarkko Sakkinen
  1 sibling, 0 replies; 3+ messages in thread
From: Jarkko Sakkinen @ 2017-05-25 22:35 UTC (permalink / raw)
  To: Stefan Berger
  Cc: linux-security-module-u79uwXL29TY76Z2rM5mHXA,
	tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Thu, May 25, 2017 at 05:39:20PM -0400, Stefan Berger wrote:
> Suppress the error logging when the core TPM driver sends commands
> to the VTPM proxy driver and -EPIPE is returned in case the VTPM
> proxy driver is 'closed' (closed anonymous file descriptor).  This
> error code is only returned by the send function and by tpm_transmit
> when the VTPM proxy driver is being used.
> 
> Signed-off-by: Stefan Berger <stefanb-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>

This have to hold up until some time next week as I have to make sure
that I understand that this is the right choice, which requirest to
study vtpm implementation.

I'm travelling right now.

/Jarkko

> ---
>  drivers/char/tpm/tpm-interface.c | 4 ++--
>  drivers/char/tpm/tpm2-cmd.c      | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
> index d711186..4826fcf 100644
> --- a/drivers/char/tpm/tpm-interface.c
> +++ b/drivers/char/tpm/tpm-interface.c
> @@ -429,11 +429,11 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space,
>  		goto out;
>  
>  	rc = chip->ops->send(chip, (u8 *) buf, count);
> -	if (rc < 0) {
> +	if (rc < 0 && rc != -EPIPE)
>  		dev_err(&chip->dev,
>  			"tpm_transmit: tpm_send: error %d\n", rc);
> +	if (rc < 0)
>  		goto out;
> -	}
>  
>  	if (chip->flags & TPM_CHIP_FLAG_IRQ)
>  		goto out_recv;
> diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c
> index 3ee6883..3a99643 100644
> --- a/drivers/char/tpm/tpm2-cmd.c
> +++ b/drivers/char/tpm/tpm2-cmd.c
> @@ -840,7 +840,7 @@ void tpm2_shutdown(struct tpm_chip *chip, u16 shutdown_type)
>  	/* In places where shutdown command is sent there's no much we can do
>  	 * except print the error code on a system failure.
>  	 */
> -	if (rc < 0)
> +	if (rc < 0 && rc != -EPIPE)
>  		dev_warn(&chip->dev, "transmit returned %d while stopping the TPM",
>  			 rc);
>  }
> -- 
> 2.4.3
> 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

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

end of thread, other threads:[~2017-05-25 22:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-25 21:39 [PATCH v2] tpm: vtpm_proxy: Suppresse error logging when in closed state Stefan Berger
     [not found] ` <1495748360-26558-1-git-send-email-stefanb-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2017-05-25 21:53   ` Joe Perches
2017-05-25 22:35   ` 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).