]> git.ipfire.org Git - thirdparty/linux.git/commit
KVM: arm64: Fix memory leak in hyp_trace_unload()
authorVincent Donnefort <vdonnefort@google.com>
Thu, 21 May 2026 12:46:13 +0000 (13:46 +0100)
committerMarc Zyngier <maz@kernel.org>
Wed, 27 May 2026 13:07:24 +0000 (14:07 +0100)
commitadae9996c04fea3b1791099b6d79e1df76d50849
tree2f1c89dbcf04b3fa3f4dd3e71cfc91f49faa4e6c
parenta23780ea9db3f3cadbb52ff6151384bff89d95d2
KVM: arm64: Fix memory leak in hyp_trace_unload()

During trace remote loading, hyp_trace_load() allocates the descriptor
pages but fails to store the allocated size in trace_buffer->desc_size.
As a result, when unloading the trace buffer, hyp_trace_unload() calls
free_pages_exact() with a size of 0 which fails to free the memory.

Fix this by updating the descriptor size in trace_buffer->desc_size.

Fixes: 3aed038aac8d ("KVM: arm64: Add trace remote for the nVHE/pKVM hyp")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
Link: https://patch.msgid.link/20260521124613.911067-4-vdonnefort@google.com
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/kvm/hyp_trace.c