Hi, is there any problem in this with the trivial patch below? I just get the same crash again with stable 5.1 kernel... Milan On 12/06/2019 10:42, Milan Broz wrote: > If clk_enable is not defined and chip initialization > is canceled code hits null dereference. > > Easily reproducible with vTPM init fail: > swtpm chardev --tpmstate dir=nonexistent_dir --tpm2 --vtpm-proxy > > BUG: kernel NULL pointer dereference, address: 00000000 > ... > Call Trace: > tpm_chip_start+0x9d/0xa0 [tpm] > tpm_chip_register+0x10/0x1a0 [tpm] > vtpm_proxy_work+0x11/0x30 [tpm_vtpm_proxy] > process_one_work+0x214/0x5a0 > worker_thread+0x134/0x3e0 > ? process_one_work+0x5a0/0x5a0 > kthread+0xd4/0x100 > ? process_one_work+0x5a0/0x5a0 > ? kthread_park+0x90/0x90 > ret_from_fork+0x19/0x24 > > Signed-off-by: Milan Broz <gmazyland@xxxxxxxxx> > Cc: stable@xxxxxxxxxxxxxxx > --- > drivers/char/tpm/tpm-chip.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c > index 90325e1749fb..4c2af643d698 100644 > --- a/drivers/char/tpm/tpm-chip.c > +++ b/drivers/char/tpm/tpm-chip.c > @@ -95,7 +95,8 @@ int tpm_chip_start(struct tpm_chip *chip) > if (chip->locality == -1) { > ret = tpm_request_locality(chip); > if (ret) { > - chip->ops->clk_enable(chip, false); > + if (chip->ops->clk_enable) > + chip->ops->clk_enable(chip, false); > return ret; > } > } >