]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
KEYS: trusted: Fix a memory leak in tpm2_load_cmd
authorJarkko Sakkinen <jarkko@kernel.org>
Sat, 18 Oct 2025 10:30:36 +0000 (13:30 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 Jan 2026 11:57:05 +0000 (12:57 +0100)
commit9e7c63c69f57b1db1a8a1542359a6167ff8fcef1
treec277d1b72de11a9e9b301f9e3d7103361c01cd49
parentc30ed32690b23e5994ec8de4338896b687d46287
KEYS: trusted: Fix a memory leak in tpm2_load_cmd

commit 62cd5d480b9762ce70d720a81fa5b373052ae05f upstream.

'tpm2_load_cmd' allocates a tempoary blob indirectly via 'tpm2_key_decode'
but it is not freed in the failure paths. Address this by wrapping the blob
into with a cleanup helper.

Cc: stable@vger.kernel.org # v5.13+
Fixes: f2219745250f ("security: keys: trusted: use ASN.1 TPM2 key format for the blobs")
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
security/keys/trusted-keys/trusted_tpm2.c