From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796388203; b=m4HLm1Ohb+DQ/a/PSjHcKS5IJVjxQmW6C718xc5Dsp96X6BKjcqH6OuUKOt8KO3CRnNf BJARCTuylTM/E6gx3gzO+KeTkY8UZkp4bbZZZrTDWLQ5MK2hbtbgiDNU9DiIp9yoBDreP rUvNGPVbH0BluNeHyvtpjOMCWJHfMct3hVTW4M+vgviQeWHMyuo+xoODq1AOFFjkV/dFl V4P610iDFhgDF/lr9LZJZ1gVjvloq253gXoEJQ4pYp81PM1Cr85kyglmY2P7eABGQz64A W71yrt6yZIDCo1XBCuAg3fw8bhJfMDLUp5akSfzhwkaU8JD4JZDe3G8XLzQKFvFkPYw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796388203; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=OkCgBLM0Cfc0XOiWVjMrl205aa5Ra/RZjwpIJzjWNJ0=; b=30JEWAhNx5ETduj2mnmvH32ovcm8DM0d9yqfjurQj/9CGa3zHiUNsPnI7bm2LtqTb8f7 UdF4UP986GFOvBJhy/SBj0A5AlEwIVBdXm+5YKdxX91WGU/1233YVuQ1l+4itlsg6AzFe X800RpZ1qEtYTm16yNaO2NhyORTiv9gYfKK4FF0MLBV8rtKjjgNglS2iH51TcRvRh3KYl +wcdEsGNODETXZ31zluJOWqBBLn7VgHkGdNDiEg0+hROu/0rb1PQ7/+cyh1e41M+I53hw nhfobxT3T3p2/5w6z0353ZiWGSfW9g18M8U0Kb7o5BnVeIyrJ8QkqGXiZsFQOaOTe7Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Qs+0Em4e; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1C7DB606A32C; Fri, 4 Dec 2026 12:43:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Qs+0Em4e Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8AA961F000C2; Fri, 4 Dec 2026 12:43:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796388203; bh=OkCgBLM0Cfc0XOiWVjMrl205aa5Ra/RZjwpIJzjWNJ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Qs+0Em4etpvMxUeGn8hJsn1Etf3yEbgM9M6gqXuSfMGTD7w5CMvYFf5bLud9axCZ6 +44drgPUWvr6JA+cB120SVMwEo3bKMkUNH4N2b+8MA5vwj/B+5OKgUF6tLd2ldwI6x 2Zgi6g6eERlJhUNMHOVmbcyVLff1eKtyExfkHV/E= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Takashi Iwai , Paul Menzel , Jarkko Sakkinen Subject: [PATCH 6.1 0522/1059] tpm: acpi: Fix memory leak at tpm_read_log_acpi() error path Date: Fri, 4 Dec 2026 19:00:53 +0900 Message-ID: <20261204100657.750822430@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-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;