]> git.baikalelectronics.ru Git - kernel.git/commit
tpm: Handle negative priv->response_len in tpm_common_read()
authorTadeusz Struk <tadeusz.struk@intel.com>
Tue, 7 Jan 2020 22:04:48 +0000 (14:04 -0800)
committerJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Wed, 8 Jan 2020 16:11:09 +0000 (18:11 +0200)
commit0b1eb2953de6642d7397841e6dae70739fa4fd9a
tree70711c264122f4a563d9b27360f5fa5411dd28c2
parentbff8f779638d1bfc3e1932e6ca6ee214422a4e4f
tpm: Handle negative priv->response_len in tpm_common_read()

The priv->response_length can hold the size of an response or an negative
error code, and the tpm_common_read() needs to handle both cases correctly.
Changed the type of response_length to signed and accounted for negative
value in tpm_common_read().

Cc: stable@vger.kernel.org
Fixes: 085f24905ca2 ("tpm: fix invalid locking in NONBLOCKING mode")
Reported-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
drivers/char/tpm/tpm-dev-common.c
drivers/char/tpm/tpm-dev.h