[xen stable-4.9] xen/arm: Fix the issue in cmp_mmio_handler used in find_mmio_handler

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[xen stable-4.9] xen/arm: Fix the issue in cmp_mmio_handler used in find_mmio_handler

patchbot
commit 9cde7a833db53c9c3a88b767af8c7cb07053a6fd
Author:     Bhupinder Thakur <[hidden email]>
AuthorDate: Fri Sep 29 11:29:46 2017 +0530
Commit:     Stefano Stabellini <[hidden email]>
CommitDate: Fri Oct 6 17:42:52 2017 -0700

    xen/arm: Fix the issue in cmp_mmio_handler used in find_mmio_handler
   
    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 <[hidden email]>
    Signed-off-by: Stefano Stabellini <[hidden email]>
    Reviewed-by: Stefano Stabellini <[hidden email]>
    (cherry picked from commit b7ed331353a14f43f53eaf6a3a543ec8385193a3)
---
 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;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.9

_______________________________________________
Xen-changelog mailing list
[hidden email]
https://lists.xenproject.org/xen-changelog