mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ricardo Schwarzmeier <Ricardo.Schwarzmeier@infineon.com>
To: <linux-integrity@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <peterhuewe@gmx.de>,
	<jarkko.sakkinen@linux.intel.com>, <jgg@ziepe.ca>,
	<arnd@arndb.de>, <gregkh@linuxfoundation.org>,
	Ricardo Schwarzmeier <Ricardo.Schwarzmeier@infineon.com>
Subject: [PATCH v2] tpm: Return the actual size when receiving an unsupported command
Date: Wed, 20 Jun 2018 11:55:07 +0200	[thread overview]
Message-ID: <20180620095507.682-1-Ricardo.Schwarzmeier@infineon.com> (raw)

The command size is computed for the header anyway.
It can as well indicate the correct number of bytes to read from the driver.
Fixes: 095531f891e6 ("tpm: return a TPM_RC_COMMAND_CODE response if command is not implemented")

Signed-off-by: Ricardo Schwarzmeier <Ricardo.Schwarzmeier@infineon.com>
---
 drivers/char/tpm/tpm-interface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
index e32f6e85dc6d..0923e81505a5 100644
--- a/drivers/char/tpm/tpm-interface.c
+++ b/drivers/char/tpm/tpm-interface.c
@@ -423,7 +423,7 @@ static ssize_t tpm_try_transmit(struct tpm_chip *chip,
 		header->tag = cpu_to_be16(TPM2_ST_NO_SESSIONS);
 		header->return_code = cpu_to_be32(TPM2_RC_COMMAND_CODE |
 						  TSS2_RESMGR_TPM_RC_LAYER);
-		return bufsiz;
+		return header->length;
 	}
 
 	if (bufsiz > TPM_BUFSIZE)
-- 
2.17.1


             reply	other threads:[~2018-06-20 10:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-20  9:55 Ricardo Schwarzmeier [this message]
2018-06-20 14:14 ` kbuild test robot
2018-06-21 16:48 ` Jarkko Sakkinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180620095507.682-1-Ricardo.Schwarzmeier@infineon.com \
    --to=ricardo.schwarzmeier@infineon.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=jarkko.sakkinen@linux.intel.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterhuewe@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®