]> git.baikalelectronics.ru Git - kernel.git/commit
tpm: Wrap the buffer from the caller to tpm_buf in tpm_send()
authorJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Mon, 16 Sep 2019 08:38:34 +0000 (11:38 +0300)
committerJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Tue, 24 Sep 2019 23:43:57 +0000 (02:43 +0300)
commit555af91e8d0e1fa86a64cb9c2db8005e26e5f727
tree4a32aa8985f245ac09db5cc7c59a99814e1a48d0
parent06b210f12da0854602aebd1df936a62a0a26f315
tpm: Wrap the buffer from the caller to tpm_buf in tpm_send()

tpm_send() does not give anymore the result back to the caller. This
would require another memcpy(), which kind of tells that the whole
approach is somewhat broken. Instead, as Mimi suggested, this commit
just wraps the data to the tpm_buf, and thus the result will not go to
the garbage.

Obviously this assumes from the caller that it passes large enough
buffer, which makes the whole API somewhat broken because it could be
different size than @buflen but since trusted keys is the only module
using this API right now I think that this fix is sufficient for the
moment.

In the near future the plan is to replace the parameters with a tpm_buf
created by the caller.

Reported-by: Mimi Zohar <zohar@linux.ibm.com>
Suggested-by: Mimi Zohar <zohar@linux.ibm.com>
Cc: stable@vger.kernel.org
Fixes: 6cd790372901 ("use tpm_buf in tpm_transmit_cmd() as the IO parameter")
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>
drivers/char/tpm/tpm-interface.c