]> err.no Git - linux-2.6/commit
KVM: load_pdptrs() cleanups
authorRusty Russell <rusty@rustcorp.com.au>
Wed, 25 Jul 2007 03:29:51 +0000 (13:29 +1000)
committerAvi Kivity <avi@qumranet.com>
Sat, 13 Oct 2007 08:18:20 +0000 (10:18 +0200)
commitc820c2aa27bb5b6069aa708b0a0b44b59a16bfa7
tree4fbf8adca97cafb1f52968fed36963fb36c4254d
parent3ccb8827fb3bd389ed15320da83543d016a94822
KVM: load_pdptrs() cleanups

load_pdptrs can be handed an invalid cr3, and it should not oops.
This can happen because we injected #gp in set_cr3() after we set
vcpu->cr3 to the invalid value, or from kvm_vcpu_ioctl_set_sregs(), or
memory configuration changes after the guest did set_cr3().

We should also copy the pdpte array once, before checking and
assigning, otherwise an SMP guest can potentially alter the values
between the check and the set.

Finally one nitpick: ret = 1 should be done as late as possible: this
allows GCC to check for unset "ret" should the function change in
future.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Avi Kivity <avi@qumranet.com>
drivers/kvm/kvm_main.c