lguest: fix bug in setting guest GDT entry

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

Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by Rusty Russell and committed by Linus Torvalds 3e27249c 741f21e8

+3 -1
+3 -1
drivers/lguest/segments.c
··· 179 179 * We assume the Guest has the same number of GDT entries as the 180 180 * Host, otherwise we'd have to dynamically allocate the Guest GDT. 181 181 */ 182 - if (num >= ARRAY_SIZE(cpu->arch.gdt)) 182 + if (num >= ARRAY_SIZE(cpu->arch.gdt)) { 183 183 kill_guest(cpu, "too many gdt entries %i", num); 184 + return; 185 + } 184 186 185 187 /* Set it up, then fix it. */ 186 188 cpu->arch.gdt[num].a = lo;