kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kvm: irqchip: fix memory leak
@ 2015-09-02  7:03 Sudip Mukherjee
  2015-09-07 20:06 ` Paolo Bonzini
  2015-11-03 21:17 ` William Dauchy
  0 siblings, 2 replies; 5+ messages in thread
From: Sudip Mukherjee @ 2015-09-02  7:03 UTC (permalink / raw)
  To: Gleb Natapov, Paolo Bonzini; +Cc: linux-kernel, kvm, Sudip Mukherjee

We were taking the exit path after checking ue->flags and return value
of setup_routing_entry(), but 'e' was not freed incase of a failure.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 virt/kvm/irqchip.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/virt/kvm/irqchip.c b/virt/kvm/irqchip.c
index 21c1424..c63e54f 100644
--- a/virt/kvm/irqchip.c
+++ b/virt/kvm/irqchip.c
@@ -213,11 +213,15 @@ int kvm_set_irq_routing(struct kvm *kvm,
 			goto out;
 
 		r = -EINVAL;
-		if (ue->flags)
+		if (ue->flags) {
+			kfree(e);
 			goto out;
+		}
 		r = setup_routing_entry(new, e, ue);
-		if (r)
+		if (r) {
+			kfree(e);
 			goto out;
+		}
 		++ue;
 	}
 
-- 
1.9.1

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

* Re: [PATCH] kvm: irqchip: fix memory leak
  2015-09-02  7:03 [PATCH] kvm: irqchip: fix memory leak Sudip Mukherjee
@ 2015-09-07 20:06 ` Paolo Bonzini
  2015-11-03 21:17 ` William Dauchy
  1 sibling, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2015-09-07 20:06 UTC (permalink / raw)
  To: Sudip Mukherjee, Gleb Natapov; +Cc: linux-kernel, kvm



On 02/09/2015 09:03, Sudip Mukherjee wrote:
> We were taking the exit path after checking ue->flags and return value
> of setup_routing_entry(), but 'e' was not freed incase of a failure.
> 
> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> ---
>  virt/kvm/irqchip.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/virt/kvm/irqchip.c b/virt/kvm/irqchip.c
> index 21c1424..c63e54f 100644
> --- a/virt/kvm/irqchip.c
> +++ b/virt/kvm/irqchip.c
> @@ -213,11 +213,15 @@ int kvm_set_irq_routing(struct kvm *kvm,
>  			goto out;
>  
>  		r = -EINVAL;
> -		if (ue->flags)
> +		if (ue->flags) {
> +			kfree(e);
>  			goto out;
> +		}
>  		r = setup_routing_entry(new, e, ue);
> -		if (r)
> +		if (r) {
> +			kfree(e);
>  			goto out;
> +		}
>  		++ue;
>  	}
>  
> 

Queued, thanks.

Paolo

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

* Re: [PATCH] kvm: irqchip: fix memory leak
  2015-09-02  7:03 [PATCH] kvm: irqchip: fix memory leak Sudip Mukherjee
  2015-09-07 20:06 ` Paolo Bonzini
@ 2015-11-03 21:17 ` William Dauchy
  2015-11-04 12:48   ` Paolo Bonzini
  2015-11-04 12:57   ` Paolo Bonzini
  1 sibling, 2 replies; 5+ messages in thread
From: William Dauchy @ 2015-11-03 21:17 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Gleb Natapov, kvm, Sudip Mukherjee

[-- Attachment #1: Type: text/plain, Size: 1189 bytes --]

Hi Paolo,

I was wondering it this could be a valid candidate for -stable, don't you think?
(commit ba60c41)

Best regards,

On Sep02 12:33, Sudip Mukherjee wrote:
> We were taking the exit path after checking ue->flags and return value
> of setup_routing_entry(), but 'e' was not freed incase of a failure.
> 
> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> ---
>  virt/kvm/irqchip.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/virt/kvm/irqchip.c b/virt/kvm/irqchip.c
> index 21c1424..c63e54f 100644
> --- a/virt/kvm/irqchip.c
> +++ b/virt/kvm/irqchip.c
> @@ -213,11 +213,15 @@ int kvm_set_irq_routing(struct kvm *kvm,
>  			goto out;
>  
>  		r = -EINVAL;
> -		if (ue->flags)
> +		if (ue->flags) {
> +			kfree(e);
>  			goto out;
> +		}
>  		r = setup_routing_entry(new, e, ue);
> -		if (r)
> +		if (r) {
> +			kfree(e);
>  			goto out;
> +		}
>  		++ue;
>  	}
>  
> -- 
> 1.9.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
William

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

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

* Re: [PATCH] kvm: irqchip: fix memory leak
  2015-11-03 21:17 ` William Dauchy
@ 2015-11-04 12:48   ` Paolo Bonzini
  2015-11-04 12:57   ` Paolo Bonzini
  1 sibling, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2015-11-04 12:48 UTC (permalink / raw)
  To: William Dauchy; +Cc: Gleb Natapov, kvm, Sudip Mukherjee



On 03/11/2015 22:17, William Dauchy wrote:
> Hi Paolo,
> 
> I was wondering it this could be a valid candidate for -stable, don't you think?
> (commit ba60c41)

Indeed, feel free to propose it!

Paolo

> Best regards,
> 
> On Sep02 12:33, Sudip Mukherjee wrote:
>> We were taking the exit path after checking ue->flags and return value
>> of setup_routing_entry(), but 'e' was not freed incase of a failure.
>>
>> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
>> ---
>>  virt/kvm/irqchip.c | 8 ++++++--
>>  1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/virt/kvm/irqchip.c b/virt/kvm/irqchip.c
>> index 21c1424..c63e54f 100644
>> --- a/virt/kvm/irqchip.c
>> +++ b/virt/kvm/irqchip.c
>> @@ -213,11 +213,15 @@ int kvm_set_irq_routing(struct kvm *kvm,
>>  			goto out;
>>  
>>  		r = -EINVAL;
>> -		if (ue->flags)
>> +		if (ue->flags) {
>> +			kfree(e);
>>  			goto out;
>> +		}
>>  		r = setup_routing_entry(new, e, ue);
>> -		if (r)
>> +		if (r) {
>> +			kfree(e);
>>  			goto out;
>> +		}
>>  		++ue;
>>  	}
>>  
>> -- 
>> 1.9.1
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe kvm" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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

* Re: [PATCH] kvm: irqchip: fix memory leak
  2015-11-03 21:17 ` William Dauchy
  2015-11-04 12:48   ` Paolo Bonzini
@ 2015-11-04 12:57   ` Paolo Bonzini
  1 sibling, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2015-11-04 12:57 UTC (permalink / raw)
  To: William Dauchy; +Cc: Gleb Natapov, kvm, Sudip Mukherjee



On 03/11/2015 22:17, William Dauchy wrote:
> Hi Paolo,
> 
> I was wondering it this could be a valid candidate for -stable, don't you think?
> (commit ba60c41)

Certainly, feel free to propose it to stable@vger.kernel.org!

Paolo

> Best regards,
> 
> On Sep02 12:33, Sudip Mukherjee wrote:
>> We were taking the exit path after checking ue->flags and return value
>> of setup_routing_entry(), but 'e' was not freed incase of a failure.
>>
>> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
>> ---
>>  virt/kvm/irqchip.c | 8 ++++++--
>>  1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/virt/kvm/irqchip.c b/virt/kvm/irqchip.c
>> index 21c1424..c63e54f 100644
>> --- a/virt/kvm/irqchip.c
>> +++ b/virt/kvm/irqchip.c
>> @@ -213,11 +213,15 @@ int kvm_set_irq_routing(struct kvm *kvm,
>>  			goto out;
>>  
>>  		r = -EINVAL;
>> -		if (ue->flags)
>> +		if (ue->flags) {
>> +			kfree(e);
>>  			goto out;
>> +		}
>>  		r = setup_routing_entry(new, e, ue);
>> -		if (r)
>> +		if (r) {
>> +			kfree(e);
>>  			goto out;
>> +		}
>>  		++ue;
>>  	}
>>  
>> -- 
>> 1.9.1
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe kvm" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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

end of thread, other threads:[~2015-11-04 12:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-02  7:03 [PATCH] kvm: irqchip: fix memory leak Sudip Mukherjee
2015-09-07 20:06 ` Paolo Bonzini
2015-11-03 21:17 ` William Dauchy
2015-11-04 12:48   ` Paolo Bonzini
2015-11-04 12:57   ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).