From: Bhupinder Thakur <bhupinder.thakur@linaro.org>
To: xen-devel@lists.xenproject.org
Cc: Julien Grall <julien.grall@arm.com>,
Stefano Stabellini <sstabellini@kernel.org>
Subject: [PATCH v3] xen/arm: Fix the issue in cmp_mmio_handler used in find_mmio_handler
Date: Fri, 29 Sep 2017 11:29:46 +0530 [thread overview]
Message-ID: <1506664786-8343-1-git-send-email-bhupinder.thakur@linaro.org> (raw)
This patch fixes the wrong range check done in cmp_mmio_handler().
This function returns -1 , 0 or 1 based on whether the key value
is below the range, in the range or above the range where the range is
(start, start+size). However, it should check against (start, start+size-1)
because start+size falls outside the range.
This resulted in returning a wrong mmio_handler for a given mmio address which
happened to be start+size.
This bug was introduced when the mmio region search switched from
linear search to binary search in the following commit:
8047e09 "xen/arm: io: Use binary search for mmio handler lookup".
Signed-off-by: Bhupinder Thakur <bhupinder.thakur@linaro.org>
---
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Julien Grall <julien.grall@arm.com>
This patch may have to be back ported to 4.8 also.
xen/arch/arm/io.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xen/arch/arm/io.c b/xen/arch/arm/io.c
index e216128..c748d8f 100644
--- a/xen/arch/arm/io.c
+++ b/xen/arch/arm/io.c
@@ -79,7 +79,7 @@ static int cmp_mmio_handler(const void *key, const void *elem)
if ( handler0->addr < handler1->addr )
return -1;
- if ( handler0->addr > (handler1->addr + handler1->size) )
+ if ( handler0->addr >= (handler1->addr + handler1->size) )
return 1;
return 0;
--
2.7.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next reply other threads:[~2017-09-29 5:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-29 5:59 Bhupinder Thakur [this message]
2017-09-29 18:52 ` [PATCH v3] xen/arm: Fix the issue in cmp_mmio_handler used in find_mmio_handler Stefano Stabellini
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=1506664786-8343-1-git-send-email-bhupinder.thakur@linaro.org \
--to=bhupinder.thakur@linaro.org \
--cc=julien.grall@arm.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.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).