[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging-4.10] memory: fix off-by-one in XSA-346 change



commit 17ec9b43af072051edb1380a5eb459a382dcafa3
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Tue Nov 24 14:17:37 2020 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Nov 24 14:17:37 2020 +0100

    memory: fix off-by-one in XSA-346 change
    
    The comparison against ARRAY_SIZE() needs to be >= in order to avoid
    overrunning the pages[] array.
    
    This is XSA-355.
    
    Fixes: 5777a3742d88 ("IOMMU: hold page ref until after deferred TLB flush")
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Julien Grall <jgrall@xxxxxxxxxx>
    master commit: 9b156bcc3ffcc7949edd4460b718a241e87ae302
    master date: 2020-11-24 14:01:31 +0100
---
 xen/common/memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/memory.c b/xen/common/memory.c
index 08fc9252a3..b08c614e39 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -807,7 +807,7 @@ static int xenmem_add_to_physmap(struct domain *d,
             ++extra.ppage;
 
         /* Check for continuation if it's not the last iteration. */
-        if ( (++done > ARRAY_SIZE(pages) && extra.ppage) ||
+        if ( (++done >= ARRAY_SIZE(pages) && extra.ppage) ||
              (xatp->size > done && hypercall_preempt_check()) )
         {
             rc = start + done;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.10



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.