]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
tpm: tpm_vtpm_proxy: fix a race condition in /dev/vtpmx creation
authorJarkko Sakkinen <jarkko.sakkinen@tuni.fi>
Mon, 15 May 2023 22:25:54 +0000 (01:25 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 11 Aug 2023 09:33:44 +0000 (11:33 +0200)
commit509d21f1c4bb9d35d397fca3226165b156a7639f
treeaf43d7996f3dd3a5383b8e2b0bfc02d0cc471034
parent618d60dc742e78aa9b2b9eaa49ce1fae254ea3b6
tpm: tpm_vtpm_proxy: fix a race condition in /dev/vtpmx creation

commit f4032d615f90970d6c3ac1d9c0bce3351eb4445c upstream.

/dev/vtpmx is made visible before 'workqueue' is initialized, which can
lead to a memory corruption in the worst case scenario.

Address this by initializing 'workqueue' as the very first step of the
driver initialization.

Cc: stable@vger.kernel.org
Fixes: 6f99612e2500 ("tpm: Proxy driver for supporting multiple emulated TPMs")
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@tuni.fi>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/char/tpm/tpm_vtpm_proxy.c