From: Paolo Bonzini <pbonzini@redhat.com>
To: Chen Gang <gang.chen.5i5j@gmail.com>, gleb@kernel.org
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 17:49:53 +0200 [thread overview]
Message-ID: <53F37221.5020508@redhat.com> (raw)
In-Reply-To: <53F370CD.80201@gmail.com>
Il 19/08/2014 17:44, Chen Gang ha scritto:
> Hello maintainers:
>
> Please help check this patch, when you have time.
Hi, it's already on its way to 3.17-rc2, but I first have to run a bunch
of tests.
Paolo
> 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;
>> }
>>
next prev parent reply other threads:[~2014-08-19 15:50 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
2014-08-19 15:49 ` Paolo Bonzini [this message]
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=53F37221.5020508@redhat.com \
--to=pbonzini@redhat.com \
--cc=gang.chen.5i5j@gmail.com \
--cc=gleb@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).