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>
Sun, 23 Jul 2023 11:49:31 +0000 (13:49 +0200)
commit99b998fb9d7d2d2d9dbb3e19db2d0ade02f5a604
treeec9a20b4214acec683d55f2a5d628b60d9afef11
parent00283137001ff4752d49bb1093df4eae67c6f493
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