diff options
Diffstat (limited to 'drivers/lguest/interrupts_and_traps.c')
-rw-r--r-- | drivers/lguest/interrupts_and_traps.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/lguest/interrupts_and_traps.c b/drivers/lguest/interrupts_and_traps.c index 49787e964a0..49aa55577d0 100644 --- a/drivers/lguest/interrupts_and_traps.c +++ b/drivers/lguest/interrupts_and_traps.c | |||
@@ -195,13 +195,16 @@ static int has_err(unsigned int trap) | |||
195 | /* deliver_trap() returns true if it could deliver the trap. */ | 195 | /* deliver_trap() returns true if it could deliver the trap. */ |
196 | int deliver_trap(struct lguest *lg, unsigned int num) | 196 | int deliver_trap(struct lguest *lg, unsigned int num) |
197 | { | 197 | { |
198 | u32 lo = lg->idt[num].a, hi = lg->idt[num].b; | 198 | /* Trap numbers are always 8 bit, but we set an impossible trap number |
199 | * for traps inside the Switcher, so check that here. */ | ||
200 | if (num >= ARRAY_SIZE(lg->idt)) | ||
201 | return 0; | ||
199 | 202 | ||
200 | /* Early on the Guest hasn't set the IDT entries (or maybe it put a | 203 | /* Early on the Guest hasn't set the IDT entries (or maybe it put a |
201 | * bogus one in): if we fail here, the Guest will be killed. */ | 204 | * bogus one in): if we fail here, the Guest will be killed. */ |
202 | if (!idt_present(lo, hi)) | 205 | if (!idt_present(lg->idt[num].a, lg->idt[num].b)) |
203 | return 0; | 206 | return 0; |
204 | set_guest_interrupt(lg, lo, hi, has_err(num)); | 207 | set_guest_interrupt(lg, lg->idt[num].a, lg->idt[num].b, has_err(num)); |
205 | return 1; | 208 | return 1; |
206 | } | 209 | } |
207 | 210 | ||