From: Rusty Russell Date: Mon, 4 Jan 2010 08:56:14 +0000 (+1030) Subject: lguest: fix bug in setting guest GDT entry X-Git-Tag: v2.6.33-rc3~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3e27249c84beed1c79d767b350e52ad038db9053;p=platform%2Fkernel%2Flinux-stable.git lguest: fix bug in setting guest GDT entry We kill the guest, but then we blatt random stuff. Reported-by: Dan Carpenter Signed-off-by: Rusty Russell Cc: stable@kernel.org Signed-off-by: Linus Torvalds --- diff --git a/drivers/lguest/segments.c b/drivers/lguest/segments.c index 951c57b..ede4658 100644 --- a/drivers/lguest/segments.c +++ b/drivers/lguest/segments.c @@ -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;