public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] s390: kvm/sigp.c: fix memory leakage
@ 2013-01-14 21:39 Cong Ding
  2013-01-15 10:08 ` Cornelia Huck
  0 siblings, 1 reply; 2+ messages in thread
From: Cong Ding @ 2013-01-14 21:39 UTC (permalink / raw)
  To: Marcelo Tosatti, Gleb Natapov, Christian Borntraeger,
	Cornelia Huck, linux390, Martin Schwidefsky, Heiko Carstens, kvm,
	linux-s390, linux-kernel
  Cc: Cong Ding

the variable inti should be freed in the branch CPUSTAT_STOPPED.

Signed-off-by: Cong Ding <dinggnu@gmail.com>
---
 arch/s390/kvm/sigp.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/s390/kvm/sigp.c b/arch/s390/kvm/sigp.c
index 461e841..1c48ab2 100644
--- a/arch/s390/kvm/sigp.c
+++ b/arch/s390/kvm/sigp.c
@@ -137,8 +137,10 @@ static int __inject_sigp_stop(struct kvm_s390_local_interrupt *li, int action)
 	inti->type = KVM_S390_SIGP_STOP;
 
 	spin_lock_bh(&li->lock);
-	if ((atomic_read(li->cpuflags) & CPUSTAT_STOPPED))
+	if ((atomic_read(li->cpuflags) & CPUSTAT_STOPPED)) {
+		kfree(inti);
 		goto out;
+	}
 	list_add_tail(&inti->list, &li->list);
 	atomic_set(&li->active, 1);
 	atomic_set_mask(CPUSTAT_STOP_INT, li->cpuflags);
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] s390: kvm/sigp.c: fix memory leakage
  2013-01-14 21:39 [PATCH] s390: kvm/sigp.c: fix memory leakage Cong Ding
@ 2013-01-15 10:08 ` Cornelia Huck
  0 siblings, 0 replies; 2+ messages in thread
From: Cornelia Huck @ 2013-01-15 10:08 UTC (permalink / raw)
  To: Cong Ding
  Cc: Marcelo Tosatti, Gleb Natapov, Christian Borntraeger, linux390,
	Martin Schwidefsky, Heiko Carstens, kvm, linux-s390, linux-kernel

On Mon, 14 Jan 2013 22:39:54 +0100
Cong Ding <dinggnu@gmail.com> wrote:

> the variable inti should be freed in the branch CPUSTAT_STOPPED.
> 
> Signed-off-by: Cong Ding <dinggnu@gmail.com>
> ---
>  arch/s390/kvm/sigp.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/s390/kvm/sigp.c b/arch/s390/kvm/sigp.c
> index 461e841..1c48ab2 100644
> --- a/arch/s390/kvm/sigp.c
> +++ b/arch/s390/kvm/sigp.c
> @@ -137,8 +137,10 @@ static int __inject_sigp_stop(struct kvm_s390_local_interrupt *li, int action)
>  	inti->type = KVM_S390_SIGP_STOP;
> 
>  	spin_lock_bh(&li->lock);
> -	if ((atomic_read(li->cpuflags) & CPUSTAT_STOPPED))
> +	if ((atomic_read(li->cpuflags) & CPUSTAT_STOPPED)) {
> +		kfree(inti);
>  		goto out;
> +	}
>  	list_add_tail(&inti->list, &li->list);
>  	atomic_set(&li->active, 1);
>  	atomic_set_mask(CPUSTAT_STOP_INT, li->cpuflags);

Thanks, applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-01-15 10:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-14 21:39 [PATCH] s390: kvm/sigp.c: fix memory leakage Cong Ding
2013-01-15 10:08 ` Cornelia Huck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox