]> Git Repo - linux.git/commitdiff
KVM: s390: prevent buffer overrun on memory hotplug during migration
authorChristian Borntraeger <[email protected]>
Thu, 21 Dec 2017 08:18:22 +0000 (09:18 +0100)
committerChristian Borntraeger <[email protected]>
Fri, 22 Dec 2017 14:22:41 +0000 (15:22 +0100)
We must not go beyond the pre-allocated buffer. This can happen when
a new memory slot is added during migration.

Reported-by: David Hildenbrand <[email protected]>
Signed-off-by: Christian Borntraeger <[email protected]>
Cc: [email protected] # 4.13+
Fixes: 190df4a212a7 (KVM: s390: CMMA tracking, ESSA emulation, migration mode)
Reviewed-by: Cornelia Huck <[email protected]>
Reviewed-by: David Hildenbrand <[email protected]>
arch/s390/kvm/priv.c

index 572496c688cc0c647bd220310bfdc6e9635d4723..0714bfa56da0f54cae66b26bd5329b18beb77b0b 100644 (file)
@@ -1006,7 +1006,7 @@ static inline int do_essa(struct kvm_vcpu *vcpu, const int orc)
                cbrlo[entries] = gfn << PAGE_SHIFT;
        }
 
-       if (orc) {
+       if (orc && gfn < ms->bitmap_size) {
                /* increment only if we are really flipping the bit to 1 */
                if (!test_and_set_bit(gfn, ms->pgste_bitmap))
                        atomic64_inc(&ms->dirty_pages);
This page took 0.059667 seconds and 4 git commands to generate.