KVM: MMU: fix incorrect return of spte
authorZhao Jin <cronozhj@gmail.com>
Mon, 19 Sep 2011 04:19:51 +0000 (12:19 +0800)
committerAvi Kivity <avi@redhat.com>
Sun, 25 Sep 2011 16:13:25 +0000 (19:13 +0300)
__update_clear_spte_slow should return original spte while the
current code returns low half of original spte combined with high
half of new spte.

Signed-off-by: Zhao Jin <cronozhj@gmail.com>
Reviewed-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
arch/x86/kvm/mmu.c

index 1c5b69373a0078b6926f04d694d42da5cd9a51ae..8e8da7960dbeed8be684c770a1ba4cc0c7653e08 100644 (file)
@@ -400,7 +400,8 @@ static u64 __update_clear_spte_slow(u64 *sptep, u64 spte)
 
        /* xchg acts as a barrier before the setting of the high bits */
        orig.spte_low = xchg(&ssptep->spte_low, sspte.spte_low);
-       orig.spte_high = ssptep->spte_high = sspte.spte_high;
+       orig.spte_high = ssptep->spte_high;
+       ssptep->spte_high = sspte.spte_high;
        count_spte_clear(sptep, spte);
 
        return orig.spte;