Re: [PATCH] tpm: avoid accessing cleared ops during shutdown

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jul 10, 2020 at 11:25:44AM -0700, Andrey Pronin wrote:
> > Why does not tpm_del_char_device need this?
> 
> "Not" is a typo in the sentence above, right? tpm_del_char_device *does*
> need the fix. When tpm_class_shutdown is called it sets chip->ops to
> NULL. If tpm_del_char_device is called after that, it doesn't check if
> chip->ops is NULL (normal kernel API and char device API calls go
> through tpm_try_get_ops, but tpm_del_char_device doesn't) and proceeds to
> call tpm2_shutdown(), which tries sending the command and dereferences
> chip->ops.

It's a typo, yes. Sorry about that.

tpm_class_shutdown() is essentially tail of tpm_del_char_device().

To clean things up, I'd suggest dropping tpm_del_char_device() and
call tpm_class_shutdown() in tpm_chip_unregisters() along, and open
coding things that prepend it in tpm_del_char_device().

/Jarkko



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux Kernel]     [Linux Kernel Hardening]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux