[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <185a096b-96f1-cc99-52e8-08a35151e347@gmx.de>
Date: Wed, 29 Dec 2021 02:41:52 +0100
From: Lino Sanfilippo <LinoSanfilippo@....de>
To: Jarkko Sakkinen <jarkko@...nel.org>
Cc: peterhuewe@....de, jgg@...pe.ca, p.rosenberger@...bus.com,
linux-integrity@...r.kernel.org, linux-kernel@...r.kernel.org,
stable@...r.kernel.org
Subject: Re: [PATCH v2] tpm: fix potential NULL pointer access in
tpm_del_char_device
Hi,
On 29.12.21 at 01:13, Jarkko Sakkinen wrote:
> On Mon, Dec 20, 2021 at 04:06:35PM +0100, Lino Sanfilippo wrote:
>> Some SPI controller drivers unregister the controller in the shutdown
>> handler (e.g. BCM2835). If such a controller is used with a TPM 2 slave
>> chip->ops may be accessed when it is already NULL:
>>
>> At system shutdown the pre-shutdown handler tpm_class_shutdown() shuts down
>> TPM 2 and sets chip->ops to NULL. Then at SPI controller unregistration
>> tpm_tis_spi_remove() is called and eventually calls tpm_del_char_device()
>> which tries to shut down TPM 2 again. Thereby it accesses chip->ops again:
>> (tpm_del_char_device calls tpm_chip_start which calls tpm_clk_enable which
>> calls chip->ops->clk_enable).
>>
>> Avoid the NULL pointer access by testing if chip->ops is valid and skipping
>> the TPM 2 shutdown procedure in case it is NULL.
>>
>> Fixes: dcbeab1946454 ("tpm: fix crash in tpm_tis deinitialization")
>> Cc: stable@...r.kernel.org
>> Signed-off-by: Lino Sanfilippo <LinoSanfilippo@....de>
>
> Thank you.
>
> Reviewed-by: Jarkko Sakkinen <jarkko@...nel.org>
>
> BR,
> Jarkko
>
Thanks a lot for the review. Please note that the latest version is v3 which
contains one more Fixes tag and also a tag for the review by Stefan. I also
adjusted the source code comment in that version which I somehow messed up in v2.
Regards,
Lino
Powered by blists - more mailing lists