Linux s390 Architecture development
 help / color / mirror / Atom feed
From: Matthew Rosato <mjrosato@linux.ibm.com>
To: Christian Borntraeger <borntraeger@linux.ibm.com>,
	KVM <kvm@vger.kernel.org>
Cc: Janosch Frank <frankja@linux.ibm.com>,
	David Hildenbrand <david@kernel.org>,
	linux-s390 <linux-s390@vger.kernel.org>,
	Claudio Imbrenda <imbrenda@linux.ibm.com>,
	Heiko Carstens <hca@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	Sven Schnelle <svens@linux.ibm.com>,
	Douglas Freimuth <freimuth@linux.ibm.com>
Subject: Re: [PATCH 3/3] KVM: s390: memory leak in guest debug handling
Date: Tue, 4 Aug 2026 10:52:12 -0400	[thread overview]
Message-ID: <75d47b2b-9a47-407c-a02c-01fb9a58fabb@linux.ibm.com> (raw)
In-Reply-To: <20260804120631.736919-4-borntraeger@linux.ibm.com>

On 8/4/26 8:06 AM, Christian Borntraeger wrote:
> bp_data is freed only for the error case by kfree(bp_data).
> Every successful KVM_SET_GUEST_DEBUG will leak bp_data.
> 
> Fixes: 27291e2165b6 ("KVM: s390: hardware support for guest debugging")
> Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>

Maybe worth re-visiting for potential __free() usage as a follow on and
replace the goto logic.

But as a fix this LGTM.

Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>


> ---
>  arch/s390/kvm/guestdbg.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/s390/kvm/guestdbg.c b/arch/s390/kvm/guestdbg.c
> index 69835e1d4f20..4c02dbebb2eb 100644
> --- a/arch/s390/kvm/guestdbg.c
> +++ b/arch/s390/kvm/guestdbg.c
> @@ -267,6 +267,7 @@ int kvm_s390_import_bp_data(struct kvm_vcpu *vcpu,
>  	vcpu->arch.guestdbg.hw_bp_info = bp_info;
>  	vcpu->arch.guestdbg.nr_hw_wp = nr_wp;
>  	vcpu->arch.guestdbg.hw_wp_info = wp_info;
> +	kfree(bp_data);
>  	return 0;
>  error:
>  	kfree(bp_data);


      parent reply	other threads:[~2026-08-04 14:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-04 12:06 [PATCH 0/3] KVM: s390: more fixes Christian Borntraeger
2026-08-04 12:06 ` [PATCH 1/3] KVM: s390: remove user triggerable WARN_ON Christian Borntraeger
2026-08-04 12:16   ` sashiko-bot
2026-08-04 13:24   ` Matthew Rosato
2026-08-04 12:06 ` [PATCH 2/3] KVM: s390: zero initialize irq for inject_pfault_token Christian Borntraeger
2026-08-04 12:31   ` sashiko-bot
2026-08-04 13:28   ` Matthew Rosato
2026-08-04 12:06 ` [PATCH 3/3] KVM: s390: memory leak in guest debug handling Christian Borntraeger
2026-08-04 12:29   ` sashiko-bot
2026-08-04 14:52   ` Matthew Rosato [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=75d47b2b-9a47-407c-a02c-01fb9a58fabb@linux.ibm.com \
    --to=mjrosato@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=david@kernel.org \
    --cc=frankja@linux.ibm.com \
    --cc=freimuth@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=svens@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox