5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Takashi Iwai commit 03fcb358249dc715124b3616f814ea0ecc6ec36c upstream. When devm_add_action() returns an error, tpm_read_log_acpi() clears log->bios_event_log unnecessarily to NULL before calling tpm_bios_log_free(), and it would lead to a memory leak of the allocated log buffer. Fix it by simply jumping to the err. Cc: stable@vger.kernel.org # v6.18+ Fixes: a3a860bc0fd6 ("tpm: Change to kvalloc() in eventlog/acpi.c") Signed-off-by: Takashi Iwai Reviewed-by: Paul Menzel Reviewed-by: Jarkko Sakkinen Link: https://lore.kernel.org/r/20261109173756.742248-1-tiwai@suse.de Signed-off-by: Jarkko Sakkinen Signed-off-by: Greg Kroah-Hartman --- drivers/char/tpm/eventlog/acpi.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) --- a/drivers/char/tpm/eventlog/acpi.c +++ b/drivers/char/tpm/eventlog/acpi.c @@ -168,10 +168,8 @@ int tpm_read_log_acpi(struct tpm_chip *c } ret = devm_add_action(&chip->dev, tpm_bios_log_free, log->bios_event_log); - if (ret) { - log->bios_event_log = NULL; + if (ret) goto err; - } return format;