From: Peter Xu <peterx@redhat.com>
To: qemu-devel@nongnu.org
Cc: Yan Zhao <yan.y.zhao@intel.com>,
"Michael S . Tsirkin" <mst@redhat.com>,
Jason Wang <jasowang@redhat.com>,
peterx@redhat.com, Auger Eric <eric.auger@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: [Qemu-devel] [PATCH v2 1/2] intel_iommu: Fix incorrect "end" for vtd_address_space_unmap
Date: Mon, 24 Jun 2019 17:18:10 +0800 [thread overview]
Message-ID: <20190624091811.30412-2-peterx@redhat.com> (raw)
In-Reply-To: <20190624091811.30412-1-peterx@redhat.com>
From: Yan Zhao <yan.y.zhao@intel.com>
IOMMUNotifier is with inclusive ranges, so we should check
against (VTD_ADDRESS_SIZE(s->aw_bits) - 1).
Signed-off-by: Yan Zhao <yan.y.zhao@intel.com>
[peterx: split from another bigger patch]
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
---
hw/i386/intel_iommu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
index 44b1231157..719ce19ab3 100644
--- a/hw/i386/intel_iommu.c
+++ b/hw/i386/intel_iommu.c
@@ -3379,12 +3379,12 @@ static void vtd_address_space_unmap(VTDAddressSpace *as, IOMMUNotifier *n)
* VT-d spec), otherwise we need to consider overflow of 64 bits.
*/
- if (end > VTD_ADDRESS_SIZE(s->aw_bits)) {
+ if (end > VTD_ADDRESS_SIZE(s->aw_bits) - 1) {
/*
* Don't need to unmap regions that is bigger than the whole
* VT-d supported address space size
*/
- end = VTD_ADDRESS_SIZE(s->aw_bits);
+ end = VTD_ADDRESS_SIZE(s->aw_bits) - 1;
}
assert(start <= end);
--
2.21.0
next prev parent reply other threads:[~2019-06-24 9:20 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-24 9:18 [Qemu-devel] [PATCH v2 0/2] intel_iommu: Fix unexpected unmaps during global unmap Peter Xu
2019-06-24 9:18 ` Peter Xu [this message]
2019-07-04 5:39 ` [Qemu-devel] [PATCH v2 1/2] intel_iommu: Fix incorrect "end" for vtd_address_space_unmap Jason Wang
2019-06-24 9:18 ` [Qemu-devel] [PATCH v2 2/2] intel_iommu: Fix unexpected unmaps during global unmap Peter Xu
2019-06-24 10:09 ` Auger Eric
2019-06-24 11:10 ` Peter Xu
2019-06-24 12:48 ` Auger Eric
2019-06-24 13:21 ` Paolo Bonzini
2019-06-24 10:12 ` Paolo Bonzini
2019-06-25 3:02 ` Yan Zhao
2019-06-25 7:00 ` Auger Eric
2019-07-04 5:45 ` Jason Wang
2019-07-04 8:17 ` Peter Xu
2019-07-01 12:00 ` [Qemu-devel] [PATCH v2 0/2] " Michael S. Tsirkin
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=20190624091811.30412-2-peterx@redhat.com \
--to=peterx@redhat.com \
--cc=eric.auger@redhat.com \
--cc=jasowang@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=yan.y.zhao@intel.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;
as well as URLs for NNTP newsgroup(s).