public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Chen Gang <gang.chen.5i5j@gmail.com>
To: gleb@kernel.org, pbonzini@redhat.com
Cc: kvm@vger.kernel.org,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] virt/kvm/assigned-dev.c: Set 'dev->irq_source_id' to '-1' after free it
Date: Tue, 19 Aug 2014 23:44:13 +0800	[thread overview]
Message-ID: <53F370CD.80201@gmail.com> (raw)
In-Reply-To: <53E4EED7.6050302@gmail.com>

Hello maintainers:

Please help check this patch, when you have time.

Thanks.

On 08/08/2014 11:37 PM, Chen Gang wrote:
> As a generic function, deassign_guest_irq() assumes it can be called
> even if assign_guest_irq() is not be called successfully (which can be
> triggered by ioctl from user mode, indirectly).
> 
> So for assign_guest_irq() failure process, need set 'dev->irq_source_id'
> to -1 after free 'dev->irq_source_id', or deassign_guest_irq() may free
> it again.
> 
> Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
> ---
>  virt/kvm/assigned-dev.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c
> index bf06577..5819a27 100644
> --- a/virt/kvm/assigned-dev.c
> +++ b/virt/kvm/assigned-dev.c
> @@ -526,8 +526,10 @@ static int assign_guest_irq(struct kvm *kvm,
>  		dev->irq_requested_type |= guest_irq_type;
>  		if (dev->ack_notifier.gsi != -1)
>  			kvm_register_irq_ack_notifier(kvm, &dev->ack_notifier);
> -	} else
> +	} else {
>  		kvm_free_irq_source_id(kvm, dev->irq_source_id);
> +		dev->irq_source_id = -1;
> +	}
>  
>  	return r;
>  }
> 


-- 
Chen Gang

Open share and attitude like air water and life which God blessed

  reply	other threads:[~2014-08-19 15:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-08 15:37 [PATCH] virt/kvm/assigned-dev.c: Set 'dev->irq_source_id' to '-1' after free it Chen Gang
2014-08-19 15:44 ` Chen Gang [this message]
2014-08-19 15:49   ` Paolo Bonzini
2014-08-19 23:58     ` Chen Gang
2014-08-20  0:01       ` Chen Gang
2014-08-20 11:21         ` Chen Gang

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=53F370CD.80201@gmail.com \
    --to=gang.chen.5i5j@gmail.com \
    --cc=gleb@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.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