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)
committerJarkko Sakkinen <jarkko@kernel.org>
Mon, 17 Jul 2023 19:32:30 +0000 (19:32 +0000)
commitf4032d615f90970d6c3ac1d9c0bce3351eb4445c
treeda3eb8d9bc684580b0d381c30df18f6e22765779
parentfdf0eaf11452d72945af31804e2a1048ee1b574c
tpm: tpm_vtpm_proxy: fix a race condition in /dev/vtpmx creation

/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>
drivers/char/tpm/tpm_vtpm_proxy.c