All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Nicholas Krause <xerofoify@gmail.com>, agraf@suse.com
Cc: gleb@kernel.org, kvm-ppc@vger.kernel.org, kvm@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kvm:powerpc:Fix error handling in the function mpic_set_default_irq_routing
Date: Fri, 07 Aug 2015 10:17:49 +0000	[thread overview]
Message-ID: <55C485CD.4040708@redhat.com> (raw)
In-Reply-To: <1438881190-27287-1-git-send-email-xerofoify@gmail.com>



On 06/08/2015 19:13, Nicholas Krause wrote:
> diff --git a/arch/powerpc/kvm/mpic.c b/arch/powerpc/kvm/mpic.c
> index 6249cdc..5a18859 100644
> --- a/arch/powerpc/kvm/mpic.c
> +++ b/arch/powerpc/kvm/mpic.c
> @@ -1641,13 +1641,16 @@ static void mpic_destroy(struct kvm_device *dev)
>  static int mpic_set_default_irq_routing(struct openpic *opp)
>  {
>  	struct kvm_irq_routing_entry *routing;
> +	int ret;
>  
>  	/* Create a nop default map, so that dereferencing it still works */
>  	routing = kzalloc((sizeof(*routing)), GFP_KERNEL);
>  	if (!routing)
>  		return -ENOMEM;
>  
> -	kvm_set_irq_routing(opp->kvm, routing, 0, 0);
> +	ret = kvm_set_irq_routing(opp->kvm, routing, 0, 0);
> +	if (ret)
> +		return ret;
>  
>  	kfree(routing);
>  	return 0;

The patch leaks the "routing" variable if you hit the error path.

Paolo

WARNING: multiple messages have this Message-ID (diff)
From: Paolo Bonzini <pbonzini@redhat.com>
To: Nicholas Krause <xerofoify@gmail.com>, agraf@suse.com
Cc: gleb@kernel.org, kvm-ppc@vger.kernel.org, kvm@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kvm:powerpc:Fix error handling in the function mpic_set_default_irq_routing
Date: Fri, 7 Aug 2015 12:17:49 +0200	[thread overview]
Message-ID: <55C485CD.4040708@redhat.com> (raw)
In-Reply-To: <1438881190-27287-1-git-send-email-xerofoify@gmail.com>



On 06/08/2015 19:13, Nicholas Krause wrote:
> diff --git a/arch/powerpc/kvm/mpic.c b/arch/powerpc/kvm/mpic.c
> index 6249cdc..5a18859 100644
> --- a/arch/powerpc/kvm/mpic.c
> +++ b/arch/powerpc/kvm/mpic.c
> @@ -1641,13 +1641,16 @@ static void mpic_destroy(struct kvm_device *dev)
>  static int mpic_set_default_irq_routing(struct openpic *opp)
>  {
>  	struct kvm_irq_routing_entry *routing;
> +	int ret;
>  
>  	/* Create a nop default map, so that dereferencing it still works */
>  	routing = kzalloc((sizeof(*routing)), GFP_KERNEL);
>  	if (!routing)
>  		return -ENOMEM;
>  
> -	kvm_set_irq_routing(opp->kvm, routing, 0, 0);
> +	ret = kvm_set_irq_routing(opp->kvm, routing, 0, 0);
> +	if (ret)
> +		return ret;
>  
>  	kfree(routing);
>  	return 0;

The patch leaks the "routing" variable if you hit the error path.

Paolo

  reply	other threads:[~2015-08-07 10:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-06 17:13 [PATCH] kvm:powerpc:Fix error handling in the function mpic_set_default_irq_routing Nicholas Krause
2015-08-06 17:13 ` Nicholas Krause
2015-08-07 10:17 ` Paolo Bonzini [this message]
2015-08-07 10:17   ` Paolo Bonzini
  -- strict thread matches above, loose matches on Subject: below --
2015-08-07 13:47 Nicholas Krause
2015-08-07 13:47 ` Nicholas Krause
2015-08-07 13:59 ` Paolo Bonzini
2015-08-07 13:59   ` Paolo Bonzini
2015-08-07 14:00   ` nick
2015-08-07 14:00     ` nick

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=55C485CD.4040708@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=agraf@suse.com \
    --cc=gleb@kernel.org \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=xerofoify@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.