]> www.infradead.org Git - users/dwmw2/linux.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 5 Oct 2019 11:14:03 +0000 (13:14 +0200)
commit843d38c96532d4a5fcc1acd774f9f0e93ca0d58b
tree5b178711462febe5faa29b2224cd5c65246b45ef
parentd59609b135ac73f6d5a90f945605fd0a522ae878
tpm: Wrap the buffer from the caller to tpm_buf in tpm_send()

commit e13cd21ffd50a07b55dcc4d8c38cedf27f28eaa1 upstream.

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: 412eb585587a ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/char/tpm/tpm-interface.c