tpm: fix response size validation in tpm_get_random()
authorJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Mon, 3 Sep 2018 01:01:26 +0000 (04:01 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Nov 2018 19:08:48 +0000 (11:08 -0800)
commitc6d2e2023c2c0dd91cf8ba18fe2fa888aceb0f88
treed2c69b8d6317cc6fa1e40f04032b51f681dd082a
parente6d2f788cb714c1675645813feee23306ad39e73
tpm: fix response size validation in tpm_get_random()

commit 84b59f6487d82d3ab4247a099aba66d4d17e8b08 upstream.

When checking whether the response is large enough to be able to contain
the received random bytes in tpm_get_random() and tpm2_get_random(),
they fail to take account the header size, which should be added to the
minimum size. This commit fixes this issue.

Cc: stable@vger.kernel.org
Fixes: c659af78eb7b ("tpm: Check size of response before accessing data")
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/char/tpm/tpm-interface.c
drivers/char/tpm/tpm2-cmd.c