From: Paolo Bonzini Date: Sat, 27 Dec 2014 17:01:00 +0000 (+0100) Subject: kvm: fix sorting of memslots with base_gfn == 0 X-Git-Tag: omap-for-v4.1/prcm-dts-mfd-syscon-fix~352^2~1 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=efbeec7098eee2b3d2359d0cc24bbba0436e7f21;p=pandora-kernel.git kvm: fix sorting of memslots with base_gfn == 0 Before commit 0e60b0799fed (kvm: change memslot sorting rule from size to GFN, 2014-12-01), the memslots' sorting key was npages, meaning that a valid memslot couldn't have its sorting key equal to zero. On the other hand, a valid memslot can have base_gfn == 0, and invalid memslots are identified by base_gfn == npages == 0. Because of this, commit 0e60b0799fed broke the invariant that invalid memslots are at the end of the mslots array. When a memslot with base_gfn == 0 was created, any invalid memslot before it were left in place. This can be fixed by changing the insertion to use a ">=" comparison instead of "<=", but some care is needed to avoid breaking the case of deleting a memslot; see the comment in update_memslots. Thanks to Tiejun Chen for posting an initial patch for this bug. Reported-by: Jamie Heilman Reported-by: Andy Lutomirski Tested-by: Jamie Heilman Signed-off-by: Paolo Bonzini --- Reading git-diff-tree failed