]> xenbits.xensource.com Git - xen.git/commitdiff
x86/HVM: correct MMIO emulation cache bounds check
authorJan Beulich <jbeulich@suse.com>
Thu, 23 Jan 2025 10:14:48 +0000 (11:14 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 23 Jan 2025 10:14:48 +0000 (11:14 +0100)
To avoid overrunning the internal buffer we need to take the offset into
the buffer into account.

Fixes: d95da91fb497 ("x86/HVM: grow MMIO cache data size to 64 bytes")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
xen/arch/x86/hvm/emulate.c

index a1935a1748305375de1135b2280f30feded2b050..f3b5800d811e5795ca5c9931be93a8acfd87ffc3 100644 (file)
@@ -935,7 +935,7 @@ static int hvmemul_phys_mmio_access(
     }
 
     /* Accesses must not overflow the cache's buffer. */
-    if ( size > sizeof(cache->buffer) )
+    if ( offset + size > sizeof(cache->buffer) )
     {
         ASSERT_UNREACHABLE();
         return X86EMUL_UNHANDLEABLE;