lkml.org 
[lkml]   [2023]   [Aug]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 1/3] tpm: Add a missing check for TPM_CHIP_FLAG_HWRNG_DISABLED
From
On Thu Aug 3, 2023 at 4:50 AM EEST, Mario Limonciello wrote:
> If the TPM is opted out of hwrng the error handling for
> tpm_chip_register() needs to know this so it doesn't try to clean
> up an uninitialized chip->hwrng.
>
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
> 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 e904aae9771be..8f61b784810d6 100644
> --- a/drivers/char/tpm/tpm-chip.c
> +++ b/drivers/char/tpm/tpm-chip.c
> @@ -629,7 +629,8 @@ int tpm_chip_register(struct tpm_chip *chip)
> return 0;
>
> out_hwrng:
> - if (IS_ENABLED(CONFIG_HW_RANDOM_TPM) && !tpm_is_firmware_upgrade(chip))
> + if (IS_ENABLED(CONFIG_HW_RANDOM_TPM) && !tpm_is_firmware_upgrade(chip) &&
> + !(chip->flags & TPM_CHIP_FLAG_HWRNG_DISABLED))
> hwrng_unregister(&chip->hwrng);
> out_ppi:
> tpm_bios_log_teardown(chip);
> --
> 2.34.1

Please add a fixes tag.

BR, Jarkko

\
 
 \ /
  Last update: 2023-08-03 11:01    [W:0.259 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site