Re: [PATCH v1 1/3] KVM: s390: vsie: Fix memory leak when unshadowing
From: Christoph Schlameuss
Date: Thu May 07 2026 - 04:41:22 EST
On Wed May 6, 2026 at 4:11 PM CEST, Claudio Imbrenda wrote:
> When performing a partial unshadowing, the rmap was being leaked.
>
> Add the missing kfree().
>
> Fixes: a2c17f9270cc ("KVM: s390: New gmap code")
> Signed-off-by: Claudio Imbrenda <imbrenda@xxxxxxxxxxxxx>
Reviewed-by: Christoph Schlameuss <schlameuss@xxxxxxxxxxxxx>
> ---
> arch/s390/kvm/gmap.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/arch/s390/kvm/gmap.c b/arch/s390/kvm/gmap.c
> index 3c26e35af0ef..fd1927761980 100644
> --- a/arch/s390/kvm/gmap.c
> +++ b/arch/s390/kvm/gmap.c
> @@ -1143,8 +1143,10 @@ void _gmap_handle_vsie_unshadow_event(struct gmap *parent, gfn_t gfn)
> }
> scoped_guard(spinlock, &sg->host_to_rmap_lock)
> head = radix_tree_delete(&sg->host_to_rmap, gfn);
> - gmap_for_each_rmap_safe(rmap, rnext, head)
> + gmap_for_each_rmap_safe(rmap, rnext, head) {
> gmap_unshadow_level(sg, rmap->r_gfn, rmap->level);
> + kfree(rmap);
> + }
> }
> }
>