From: Paolo Bonzini <pbonzini@redhat.com>
To: zhanghailiang <zhang.zhanghailiang@huawei.com>, kvm@vger.kernel.org
Cc: gleb@kernel.org, peter.huangpeng@huawei.com,
luonengjun@huawei.com, "Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [PATCH] kvm:iommu: fix the third parameter of kvm_iommu_put_pages
Date: Tue, 19 Aug 2014 15:00:06 +0200 [thread overview]
Message-ID: <53F34A56.3040801@redhat.com> (raw)
In-Reply-To: <1408446890-8284-1-git-send-email-zhang.zhanghailiang@huawei.com>
Il 19/08/2014 13:14, zhanghailiang ha scritto:
> The third parameter of kvm_iommu_put_pages is wrong,
> It should be 'gfn-slot->base_gfn'
This fixes a crash, doesn't it? Please mention it in the commit
message, because we have to assign a CVE for this kind of issue. It
will be CVE-2014-3601.
I have learnt about this crash last week from Michael Tsirkin, whose
patch also had the following hunk:
diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c
index 0df7d4b34dfe..1e458a7d96f1 100644
--- a/virt/kvm/iommu.c
+++ b/virt/kvm/iommu.c
@@ -123,6 +123,7 @@ int kvm_iommu_map_pages(struct kvm *kvm, struct
kvm_memory_slot *slot)
if (r) {
printk(KERN_ERR "kvm_iommu_map_address:"
"iommu failed to map pfn=%llx\n", pfn);
+ kvm_unpin_pages(kvm, pfn, page_size);
goto unmap_pages;
}
So I'm going to apply his instead.
Thanks for the report,
Paolo
> Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
> ---
> virt/kvm/iommu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c
> index 0df7d4b..c02f9a3 100644
> --- a/virt/kvm/iommu.c
> +++ b/virt/kvm/iommu.c
> @@ -134,7 +134,7 @@ int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot)
> return 0;
>
> unmap_pages:
> - kvm_iommu_put_pages(kvm, slot->base_gfn, gfn);
> + kvm_iommu_put_pages(kvm, slot->base_gfn, gfn - slot->base_gfn);
> return r;
> }
>
>
prev parent reply other threads:[~2014-08-19 13:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-19 11:14 [PATCH] kvm:iommu: fix the third parameter of kvm_iommu_put_pages zhanghailiang
2014-08-19 13:00 ` Paolo Bonzini [this message]
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=53F34A56.3040801@redhat.com \
--to=pbonzini@redhat.com \
--cc=gleb@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=luonengjun@huawei.com \
--cc=mst@redhat.com \
--cc=peter.huangpeng@huawei.com \
--cc=zhang.zhanghailiang@huawei.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.