]> git.proxmox.com Git - mirror_ubuntu-focal-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)
committerSeth Forshee <seth.forshee@canonical.com>
Mon, 6 Jan 2020 14:16:53 +0000 (08:16 -0600)
commit705e962eae0a11bd03e6178468f6aa4488853d97
tree8e70247dbf680c913feac57213443856bb360afa
parente42b922670276117e1a7df89917214d9fe54ce8e
tpm: fix invalid locking in NONBLOCKING mode

BugLink: https://bugs.launchpad.net/bugs/1858428
commit d23d12484307b40eea549b8a858f5fffad913897 upstream.

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: 9e1b74a63f776 (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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
drivers/char/tpm/tpm-dev-common.c