diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-10 11:48:46 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-10 11:48:46 -0500 |
commit | 9f99a2f0e44663517b99b69a3e4a499d0ba877df (patch) | |
tree | 92bbe9f9c9c6687a49e13e4e1bfe2a29bc736476 /drivers/xen | |
parent | 8c8ae4e8cd5a67467192f3361eeec463694f8ed8 (diff) | |
parent | 110e7c7e4f8a61a34e0ab88fc9bdf4d5c6d220b2 (diff) |
Merge branch 'stable/bug-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen
* 'stable/bug-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
xen/event: validate irq before get evtchn by irq
xen/fb: fix potential memory leak
xen/fb: fix xenfb suspend/resume race.
xen: disable ACPI NUMA for PV guests
xen/irq: Cleanup the find_unbound_irq
Diffstat (limited to 'drivers/xen')
-rw-r--r-- | drivers/xen/events.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/drivers/xen/events.c b/drivers/xen/events.c index 65f8637d13cf..74681478100a 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c | |||
@@ -170,6 +170,9 @@ static struct irq_info *info_for_irq(unsigned irq) | |||
170 | 170 | ||
171 | static unsigned int evtchn_from_irq(unsigned irq) | 171 | static unsigned int evtchn_from_irq(unsigned irq) |
172 | { | 172 | { |
173 | if (unlikely(WARN(irq < 0 || irq >= nr_irqs, "Invalid irq %d!\n", irq))) | ||
174 | return 0; | ||
175 | |||
173 | return info_for_irq(irq)->evtchn; | 176 | return info_for_irq(irq)->evtchn; |
174 | } | 177 | } |
175 | 178 | ||
@@ -405,15 +408,21 @@ static int find_unbound_irq(void) | |||
405 | { | 408 | { |
406 | struct irq_data *data; | 409 | struct irq_data *data; |
407 | int irq, res; | 410 | int irq, res; |
408 | int start = get_nr_hw_irqs(); | 411 | int bottom = get_nr_hw_irqs(); |
412 | int top = nr_irqs-1; | ||
409 | 413 | ||
410 | if (start == nr_irqs) | 414 | if (bottom == nr_irqs) |
411 | goto no_irqs; | 415 | goto no_irqs; |
412 | 416 | ||
413 | /* nr_irqs is a magic value. Must not use it.*/ | 417 | /* This loop starts from the top of IRQ space and goes down. |
414 | for (irq = nr_irqs-1; irq > start; irq--) { | 418 | * We need this b/c if we have a PCI device in a Xen PV guest |
419 | * we do not have an IO-APIC (though the backend might have them) | ||
420 | * mapped in. To not have a collision of physical IRQs with the Xen | ||
421 | * event channels start at the top of the IRQ space for virtual IRQs. | ||
422 | */ | ||
423 | for (irq = top; irq > bottom; irq--) { | ||
415 | data = irq_get_irq_data(irq); | 424 | data = irq_get_irq_data(irq); |
416 | /* only 0->15 have init'd desc; handle irq > 16 */ | 425 | /* only 15->0 have init'd desc; handle irq > 16 */ |
417 | if (!data) | 426 | if (!data) |
418 | break; | 427 | break; |
419 | if (data->chip == &no_irq_chip) | 428 | if (data->chip == &no_irq_chip) |
@@ -424,7 +433,7 @@ static int find_unbound_irq(void) | |||
424 | return irq; | 433 | return irq; |
425 | } | 434 | } |
426 | 435 | ||
427 | if (irq == start) | 436 | if (irq == bottom) |
428 | goto no_irqs; | 437 | goto no_irqs; |
429 | 438 | ||
430 | res = irq_alloc_desc_at(irq, -1); | 439 | res = irq_alloc_desc_at(irq, -1); |