]> git.baikalelectronics.ru Git - kernel.git/commit
tpm: fix invalid locking in NONBLOCKING mode
authorTadeusz Struk <tadeusz.struk@intel.com>
Thu, 12 Dec 2019 17:48:47 +0000 (09:48 -0800)
committerJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Tue, 17 Dec 2019 10:20:04 +0000 (12:20 +0200)
commitbfda1c5bafe15df28bdb367e891eba6b14db2f15
tree40e278f20d0effbf43f8065b617459067e3a1c21
parent3f26d3a84ff829e3b659bc82d8c180d2e5471a29
tpm: fix invalid locking in NONBLOCKING mode

When an application sends TPM commands in NONBLOCKING mode
the driver holds chip->tpm_mutex returning from write(),
which triggers: "WARNING: lock held when returning to user space".
To fix this issue the driver needs to release the mutex before
returning and acquire it again in tpm_dev_async_work() before
sending the command.

Cc: stable@vger.kernel.org
Fixes: fff069bf8c1c3 (tpm: add support for nonblocking operation)
Reported-by: Jeffrin Jose T <jeffrin@rajagiritech.edu.in>
Tested-by: Jeffrin Jose T <jeffrin@rajagiritech.edu.in>
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