summaryrefslogtreecommitdiffstats
path: root/drivers/lguest
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2010-01-04 09:56:14 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2010-01-04 21:33:33 +0100
commit3e27249c84beed1c79d767b350e52ad038db9053 (patch)
tree56fbbd5e952c4b01649c5b4f84dc7ce135cdc6ee /drivers/lguest
parentMerge branch 'for-linus' of git://git390.marist.edu/pub/scm/linux-2.6 (diff)
downloadlinux-3e27249c84beed1c79d767b350e52ad038db9053.tar.xz
linux-3e27249c84beed1c79d767b350e52ad038db9053.zip
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>
Diffstat (limited to 'drivers/lguest')
-rw-r--r--drivers/lguest/segments.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/lguest/segments.c b/drivers/lguest/segments.c
index 951c57b0a7e0..ede46581351a 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;