lguest: fix bug in setting guest GDT entry

We kill the guest, but then we blatt random stuff.

Reported-by: Dan Carpenter <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
Cc: [email protected]
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
Rusty Russell 2010-01-04 19:26:14 +10:30 • committed by Linus Torvalds
commit 3e27249c84

View file

@ -179,8 +179,10 @@ void load_guest_gdt_entry(struct lg_cpu *cpu, u32 num, u32 lo, u32 hi)
* We assume the Guest has the same number of GDT entries as the
* Host, otherwise we'd have to dynamically allocate the Guest GDT.
*/
if (num >= ARRAY_SIZE(cpu->arch.gdt))
if (num >= ARRAY_SIZE(cpu->arch.gdt)) {
kill_guest(cpu, "too many gdt entries %i", num);
return;
}
/* Set it up, then fix it. */
cpu->arch.gdt[num].a = lo;