Re: [PATCH] tpm: acpi: Fix memory leak at tpm_read_log_acpi() error path
From: Takashi Iwai
Date: Mon Nov 09 2026 - 11:02:58 EST
On Mon, 09 Nov 2026 16:25:45 +0100,
Jarkko Sakkinen wrote:
>
> On Mon, Nov 09, 2026 at 09:25:24AM +0100, Takashi Iwai wrote:
> > When devm_add_action() returns an error, we do NULL-clear
> > log->bios_event_log unnecessarily before calling tpm_bios_log_free(),
> > and it would lead to a memory leak of the allocated log buffer.
>
> I don't understand this. "NULL-clear" is gibberish when the actual
> bug is just spurious clear of log->bios_event_log.
It's not "spurious", but rather ill-behaving.
Because it sets NULL before calling tpm_bios_log_free(), the actually
allocated buffer won't be freed at all.
Takashi