x86/HVM: correct MMIO emulation cache bounds check

To avoid overrunning the internal buffer we need to take the offset into
the buffer into account.

Fixes: d95da91fb4 ("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>
master commit: e5339bb689
master date: 2025-01-23 11:14:48 +0100
This commit is contained in:
Jan Beulich committed 2025-02-17 13:28:13 +01:00
1 parent da7790b8f2
commit 0d2799a557
1 file changed
+1 -1
+1 -1
View File
@@ -937,7 +937,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;
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.