Skip to contentSkip to conversation

lguest: fix bug in setting guest GDT entry

PATCH New Rusty Russell 1 participant 1 message Jan 4, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lguest: fix bug in setting guest GDT entry

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

---
 drivers/lguest/segments.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/lguest/segments.c +3 -1
@@ -179,8 +179,10 @@ void load_guest_gdt_entry(struct lg_cpu 
 	 * 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;