* [rfc 0/2] x86,ioapic simplification,bugfix
@ 2009-08-01 7:47 Cyrill Gorcunov
2009-08-01 7:47 ` [rfc 1/2] x86,ioapic: introduce for_each_irq_pin helper Cyrill Gorcunov
2009-08-01 7:48 ` [rfc 2/2] x86,ioapic: throw BUG instead of NULL dereference Cyrill Gorcunov
0 siblings, 2 replies; 8+ messages in thread
From: Cyrill Gorcunov @ 2009-08-01 7:47 UTC (permalink / raw)
To: yinghai, mingo, hpa, tglx; +Cc: linux-kernel
Hi,
the series has an idea to simplify io-apic list
handling and prevent from one possible NULL
dereference. See patches comments for details.
Yinghai, please take a closer look on new body
of add_pin_to_irq_node and __eoi_ioapic_irq.
I hope I didn't miss anything.
Please review. Comments are highly appreciated.
The patches on top of -tip tree commit
| commit 160bc9d163b0ba927770056783b79a684b74acc6
| Merge: d333597 d6c585a
| Author: Ingo Molnar <mingo@elte.hu>
| Date: Sun Jul 26 14:32:39 2009 +0200
|
| Merge branch 'x86/urgent'
Cyrill
^ permalink raw reply [flat|nested] 8+ messages in thread
* [rfc 1/2] x86,ioapic: introduce for_each_irq_pin helper
2009-08-01 7:47 [rfc 0/2] x86,ioapic simplification,bugfix Cyrill Gorcunov
@ 2009-08-01 7:47 ` Cyrill Gorcunov
2009-08-04 14:11 ` Ingo Molnar
` (2 more replies)
2009-08-01 7:48 ` [rfc 2/2] x86,ioapic: throw BUG instead of NULL dereference Cyrill Gorcunov
1 sibling, 3 replies; 8+ messages in thread
From: Cyrill Gorcunov @ 2009-08-01 7:47 UTC (permalink / raw)
To: yinghai, mingo, hpa, tglx; +Cc: linux-kernel, Cyrill Gorcunov
[-- Attachment #1: x86-ioapic-for-each --]
[-- Type: text/plain, Size: 3377 bytes --]
This allow us to save a few lines of code.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---
arch/x86/kernel/apic/io_apic.c | 43 ++++++++++++++---------------------------
1 file changed, 15 insertions(+), 28 deletions(-)
Index: linux-2.6.git/arch/x86/kernel/apic/io_apic.c
=====================================================================
--- linux-2.6.git.orig/arch/x86/kernel/apic/io_apic.c
+++ linux-2.6.git/arch/x86/kernel/apic/io_apic.c
@@ -66,6 +66,8 @@
#include <asm/apic.h>
#define __apicdebuginit(type) static type __init
+#define for_each_irq_pin(entry, head) \
+ for (entry = head; entry; entry = entry->next)
/*
* Is the SiS APIC rmw bug present ?
@@ -410,7 +412,7 @@ static bool io_apic_level_ack_pending(st
unsigned long flags;
spin_lock_irqsave(&ioapic_lock, flags);
- for (entry = cfg->irq_2_pin; entry != NULL; entry = entry->next) {
+ for_each_irq_pin(entry, cfg->irq_2_pin) {
unsigned int reg;
int pin;
@@ -490,22 +492,21 @@ static void ioapic_mask_entry(int apic,
*/
static void add_pin_to_irq_node(struct irq_cfg *cfg, int node, int apic, int pin)
{
- struct irq_pin_list **entryp, *entry;
+ struct irq_pin_list **last, *entry;
- for (entryp = &cfg->irq_2_pin;
- *entryp != NULL;
- entryp = &(*entryp)->next) {
- entry = *entryp;
- /* not again, please */
+ /* don't allow duplicates */
+ last = &cfg->irq_2_pin;
+ for_each_irq_pin(entry, cfg->irq_2_pin) {
if (entry->apic == apic && entry->pin == pin)
return;
+ last = &entry->next;
}
entry = get_one_free_irq_2_pin(node);
entry->apic = apic;
entry->pin = pin;
- *entryp = entry;
+ *last = entry;
}
/*
@@ -517,7 +518,7 @@ static void __init replace_pin_at_irq_no
{
struct irq_pin_list *entry;
- for (entry = cfg->irq_2_pin; entry != NULL; entry = entry->next) {
+ for_each_irq_pin(entry, cfg->irq_2_pin) {
if (entry->apic == oldapic && entry->pin == oldpin) {
entry->apic = newapic;
entry->pin = newpin;
@@ -537,7 +538,7 @@ static void io_apic_modify_irq(struct ir
int pin;
struct irq_pin_list *entry;
- for (entry = cfg->irq_2_pin; entry != NULL; entry = entry->next) {
+ for_each_irq_pin(entry, cfg->irq_2_pin) {
unsigned int reg;
pin = entry->pin;
reg = io_apic_read(entry->apic, 0x10 + pin * 2);
@@ -1669,12 +1670,8 @@ __apicdebuginit(void) print_IO_APIC(void
if (!entry)
continue;
printk(KERN_DEBUG "IRQ%d ", irq);
- for (;;) {
+ for_each_irq_pin(entry, cfg->irq_2_pin)
printk("-> %d:%d", entry->apic, entry->pin);
- if (!entry->next)
- break;
- entry = entry->next;
- }
printk("\n");
}
@@ -2227,7 +2224,7 @@ static void __target_IO_APIC_irq(unsigne
struct irq_pin_list *entry;
u8 vector = cfg->vector;
- for (entry = cfg->irq_2_pin; entry != NULL; entry = entry->next) {
+ for_each_irq_pin(entry, cfg->irq_2_pin) {
unsigned int reg;
apic = entry->apic;
@@ -2556,20 +2553,10 @@ static void ack_apic_level(unsigned int
#ifdef CONFIG_INTR_REMAP
static void __eoi_ioapic_irq(unsigned int irq, struct irq_cfg *cfg)
{
- int apic, pin;
struct irq_pin_list *entry;
- entry = cfg->irq_2_pin;
- for (;;) {
-
- if (!entry)
- break;
-
- apic = entry->apic;
- pin = entry->pin;
- io_apic_eoi(apic, pin);
- entry = entry->next;
- }
+ for_each_irq_pin(entry, cfg->irq_2_pin)
+ io_apic_eoi(entry->apic, entry->pin);
}
static void
^ permalink raw reply [flat|nested] 8+ messages in thread
* [rfc 2/2] x86,ioapic: throw BUG instead of NULL dereference
2009-08-01 7:47 [rfc 0/2] x86,ioapic simplification,bugfix Cyrill Gorcunov
2009-08-01 7:47 ` [rfc 1/2] x86,ioapic: introduce for_each_irq_pin helper Cyrill Gorcunov
@ 2009-08-01 7:48 ` Cyrill Gorcunov
2009-08-04 14:16 ` [tip:x86/apic] x86, ioapic: Throw " tip-bot for Cyrill Gorcunov
2009-08-05 10:55 ` tip-bot for Cyrill Gorcunov
1 sibling, 2 replies; 8+ messages in thread
From: Cyrill Gorcunov @ 2009-08-01 7:48 UTC (permalink / raw)
To: yinghai, mingo, hpa, tglx; +Cc: linux-kernel, Cyrill Gorcunov
[-- Attachment #1: x86-ioapic-NULL --]
[-- Type: text/plain, Size: 754 bytes --]
Instead of plain NULL deref we better throw error
message with a backtrace. Actually we need more
gracious error handling here. Meanwhile leave it
as is.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---
arch/x86/kernel/apic/io_apic.c | 4 ++++
1 file changed, 4 insertions(+)
Index: linux-2.6.git/arch/x86/kernel/apic/io_apic.c
=====================================================================
--- linux-2.6.git.orig/arch/x86/kernel/apic/io_apic.c
+++ linux-2.6.git/arch/x86/kernel/apic/io_apic.c
@@ -503,6 +503,10 @@ static void add_pin_to_irq_node(struct i
}
entry = get_one_free_irq_2_pin(node);
+ if (!entry) {
+ printk(KERN_ERR "can not alloc irq_pin_list\n");
+ BUG_ON(1);
+ }
entry->apic = apic;
entry->pin = pin;
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [rfc 1/2] x86,ioapic: introduce for_each_irq_pin helper
2009-08-01 7:47 ` [rfc 1/2] x86,ioapic: introduce for_each_irq_pin helper Cyrill Gorcunov
@ 2009-08-04 14:11 ` Ingo Molnar
2009-08-04 14:16 ` [tip:x86/apic] x86, ioapic: Introduce for_each_irq_pin() helper tip-bot for Cyrill Gorcunov
2009-08-05 10:55 ` tip-bot for Cyrill Gorcunov
2 siblings, 0 replies; 8+ messages in thread
From: Ingo Molnar @ 2009-08-04 14:11 UTC (permalink / raw)
To: Cyrill Gorcunov; +Cc: yinghai, hpa, tglx, linux-kernel
* Cyrill Gorcunov <gorcunov@openvz.org> wrote:
> This allow us to save a few lines of code.
>
> Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
> ---
> arch/x86/kernel/apic/io_apic.c | 43 ++++++++++++++---------------------------
> 1 file changed, 15 insertions(+), 28 deletions(-)
Nice cleanup! I'll queue it up and let you know if there's any
problems with it in testing.
Ingo
^ permalink raw reply [flat|nested] 8+ messages in thread
* [tip:x86/apic] x86, ioapic: Introduce for_each_irq_pin() helper
2009-08-01 7:47 ` [rfc 1/2] x86,ioapic: introduce for_each_irq_pin helper Cyrill Gorcunov
2009-08-04 14:11 ` Ingo Molnar
@ 2009-08-04 14:16 ` tip-bot for Cyrill Gorcunov
2009-08-05 10:55 ` tip-bot for Cyrill Gorcunov
2 siblings, 0 replies; 8+ messages in thread
From: tip-bot for Cyrill Gorcunov @ 2009-08-04 14:16 UTC (permalink / raw)
To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, gorcunov, tglx, mingo
Commit-ID: a09204211bcf17eddfdbb5cb2ceb2173e0e3c0d0
Gitweb: http://git.kernel.org/tip/a09204211bcf17eddfdbb5cb2ceb2173e0e3c0d0
Author: Cyrill Gorcunov <gorcunov@openvz.org>
AuthorDate: Sat, 1 Aug 2009 11:47:59 +0400
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 4 Aug 2009 16:11:53 +0200
x86, ioapic: Introduce for_each_irq_pin() helper
This allow us to save a few lines of code.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: yinghai@kernel.org
LKML-Reference: <20090801075435.597863129@openvz.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
arch/x86/kernel/apic/io_apic.c | 43 ++++++++++++++--------------------------
1 files changed, 15 insertions(+), 28 deletions(-)
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 7e92a92..ffd8fdf 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -66,6 +66,8 @@
#include <asm/apic.h>
#define __apicdebuginit(type) static type __init
+#define for_each_irq_pin(entry, head) \
+ for (entry = head; entry; entry = entry->next)
/*
* Is the SiS APIC rmw bug present ?
@@ -410,7 +412,7 @@ static bool io_apic_level_ack_pending(struct irq_cfg *cfg)
unsigned long flags;
spin_lock_irqsave(&ioapic_lock, flags);
- for (entry = cfg->irq_2_pin; entry != NULL; entry = entry->next) {
+ for_each_irq_pin(entry, cfg->irq_2_pin) {
unsigned int reg;
int pin;
@@ -490,22 +492,21 @@ static void ioapic_mask_entry(int apic, int pin)
*/
static void add_pin_to_irq_node(struct irq_cfg *cfg, int node, int apic, int pin)
{
- struct irq_pin_list **entryp, *entry;
+ struct irq_pin_list **last, *entry;
- for (entryp = &cfg->irq_2_pin;
- *entryp != NULL;
- entryp = &(*entryp)->next) {
- entry = *entryp;
- /* not again, please */
+ /* don't allow duplicates */
+ last = &cfg->irq_2_pin;
+ for_each_irq_pin(entry, cfg->irq_2_pin) {
if (entry->apic == apic && entry->pin == pin)
return;
+ last = &entry->next;
}
entry = get_one_free_irq_2_pin(node);
entry->apic = apic;
entry->pin = pin;
- *entryp = entry;
+ *last = entry;
}
/*
@@ -517,7 +518,7 @@ static void __init replace_pin_at_irq_node(struct irq_cfg *cfg, int node,
{
struct irq_pin_list *entry;
- for (entry = cfg->irq_2_pin; entry != NULL; entry = entry->next) {
+ for_each_irq_pin(entry, cfg->irq_2_pin) {
if (entry->apic == oldapic && entry->pin == oldpin) {
entry->apic = newapic;
entry->pin = newpin;
@@ -537,7 +538,7 @@ static void io_apic_modify_irq(struct irq_cfg *cfg,
int pin;
struct irq_pin_list *entry;
- for (entry = cfg->irq_2_pin; entry != NULL; entry = entry->next) {
+ for_each_irq_pin(entry, cfg->irq_2_pin) {
unsigned int reg;
pin = entry->pin;
reg = io_apic_read(entry->apic, 0x10 + pin * 2);
@@ -1669,12 +1670,8 @@ __apicdebuginit(void) print_IO_APIC(void)
if (!entry)
continue;
printk(KERN_DEBUG "IRQ%d ", irq);
- for (;;) {
+ for_each_irq_pin(entry, cfg->irq_2_pin)
printk("-> %d:%d", entry->apic, entry->pin);
- if (!entry->next)
- break;
- entry = entry->next;
- }
printk("\n");
}
@@ -2227,7 +2224,7 @@ static void __target_IO_APIC_irq(unsigned int irq, unsigned int dest, struct irq
struct irq_pin_list *entry;
u8 vector = cfg->vector;
- for (entry = cfg->irq_2_pin; entry != NULL; entry = entry->next) {
+ for_each_irq_pin(entry, cfg->irq_2_pin) {
unsigned int reg;
apic = entry->apic;
@@ -2556,20 +2553,10 @@ static void ack_apic_level(unsigned int irq)
#ifdef CONFIG_INTR_REMAP
static void __eoi_ioapic_irq(unsigned int irq, struct irq_cfg *cfg)
{
- int apic, pin;
struct irq_pin_list *entry;
- entry = cfg->irq_2_pin;
- for (;;) {
-
- if (!entry)
- break;
-
- apic = entry->apic;
- pin = entry->pin;
- io_apic_eoi(apic, pin);
- entry = entry->next;
- }
+ for_each_irq_pin(entry, cfg->irq_2_pin)
+ io_apic_eoi(entry->apic, entry->pin);
}
static void
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [tip:x86/apic] x86, ioapic: Throw BUG instead of NULL dereference
2009-08-01 7:48 ` [rfc 2/2] x86,ioapic: throw BUG instead of NULL dereference Cyrill Gorcunov
@ 2009-08-04 14:16 ` tip-bot for Cyrill Gorcunov
2009-08-05 10:55 ` tip-bot for Cyrill Gorcunov
1 sibling, 0 replies; 8+ messages in thread
From: tip-bot for Cyrill Gorcunov @ 2009-08-04 14:16 UTC (permalink / raw)
To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, gorcunov, tglx, mingo
Commit-ID: 460ba8dfa8decb3885256fc4cbb3d2ee46a6466f
Gitweb: http://git.kernel.org/tip/460ba8dfa8decb3885256fc4cbb3d2ee46a6466f
Author: Cyrill Gorcunov <gorcunov@openvz.org>
AuthorDate: Sat, 1 Aug 2009 11:48:00 +0400
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 4 Aug 2009 16:11:54 +0200
x86, ioapic: Throw BUG instead of NULL dereference
Instead of plain NULL deref we better throw error
message with a backtrace. Actually we need more
gracious error handling here. Meanwhile leave it
as is.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: yinghai@kernel.org
LKML-Reference: <20090801075435.769301745@openvz.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
arch/x86/kernel/apic/io_apic.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index ffd8fdf..2a145d3 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -503,6 +503,10 @@ static void add_pin_to_irq_node(struct irq_cfg *cfg, int node, int apic, int pin
}
entry = get_one_free_irq_2_pin(node);
+ if (!entry) {
+ printk(KERN_ERR "can not alloc irq_pin_list\n");
+ BUG_ON(1);
+ }
entry->apic = apic;
entry->pin = pin;
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [tip:x86/apic] x86, ioapic: Introduce for_each_irq_pin() helper
2009-08-01 7:47 ` [rfc 1/2] x86,ioapic: introduce for_each_irq_pin helper Cyrill Gorcunov
2009-08-04 14:11 ` Ingo Molnar
2009-08-04 14:16 ` [tip:x86/apic] x86, ioapic: Introduce for_each_irq_pin() helper tip-bot for Cyrill Gorcunov
@ 2009-08-05 10:55 ` tip-bot for Cyrill Gorcunov
2 siblings, 0 replies; 8+ messages in thread
From: tip-bot for Cyrill Gorcunov @ 2009-08-05 10:55 UTC (permalink / raw)
To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, gorcunov, tglx, mingo
Commit-ID: 2977fb3ffc8493a2f4f0a362e8660a6cde9f1bb9
Gitweb: http://git.kernel.org/tip/2977fb3ffc8493a2f4f0a362e8660a6cde9f1bb9
Author: Cyrill Gorcunov <gorcunov@openvz.org>
AuthorDate: Sat, 1 Aug 2009 11:47:59 +0400
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 5 Aug 2009 10:30:49 +0200
x86, ioapic: Introduce for_each_irq_pin() helper
This allow us to save a few lines of code.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: yinghai@kernel.org
LKML-Reference: <20090801075435.597863129@openvz.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
arch/x86/kernel/apic/io_apic.c | 43 ++++++++++++++--------------------------
1 files changed, 15 insertions(+), 28 deletions(-)
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 7e92a92..ffd8fdf 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -66,6 +66,8 @@
#include <asm/apic.h>
#define __apicdebuginit(type) static type __init
+#define for_each_irq_pin(entry, head) \
+ for (entry = head; entry; entry = entry->next)
/*
* Is the SiS APIC rmw bug present ?
@@ -410,7 +412,7 @@ static bool io_apic_level_ack_pending(struct irq_cfg *cfg)
unsigned long flags;
spin_lock_irqsave(&ioapic_lock, flags);
- for (entry = cfg->irq_2_pin; entry != NULL; entry = entry->next) {
+ for_each_irq_pin(entry, cfg->irq_2_pin) {
unsigned int reg;
int pin;
@@ -490,22 +492,21 @@ static void ioapic_mask_entry(int apic, int pin)
*/
static void add_pin_to_irq_node(struct irq_cfg *cfg, int node, int apic, int pin)
{
- struct irq_pin_list **entryp, *entry;
+ struct irq_pin_list **last, *entry;
- for (entryp = &cfg->irq_2_pin;
- *entryp != NULL;
- entryp = &(*entryp)->next) {
- entry = *entryp;
- /* not again, please */
+ /* don't allow duplicates */
+ last = &cfg->irq_2_pin;
+ for_each_irq_pin(entry, cfg->irq_2_pin) {
if (entry->apic == apic && entry->pin == pin)
return;
+ last = &entry->next;
}
entry = get_one_free_irq_2_pin(node);
entry->apic = apic;
entry->pin = pin;
- *entryp = entry;
+ *last = entry;
}
/*
@@ -517,7 +518,7 @@ static void __init replace_pin_at_irq_node(struct irq_cfg *cfg, int node,
{
struct irq_pin_list *entry;
- for (entry = cfg->irq_2_pin; entry != NULL; entry = entry->next) {
+ for_each_irq_pin(entry, cfg->irq_2_pin) {
if (entry->apic == oldapic && entry->pin == oldpin) {
entry->apic = newapic;
entry->pin = newpin;
@@ -537,7 +538,7 @@ static void io_apic_modify_irq(struct irq_cfg *cfg,
int pin;
struct irq_pin_list *entry;
- for (entry = cfg->irq_2_pin; entry != NULL; entry = entry->next) {
+ for_each_irq_pin(entry, cfg->irq_2_pin) {
unsigned int reg;
pin = entry->pin;
reg = io_apic_read(entry->apic, 0x10 + pin * 2);
@@ -1669,12 +1670,8 @@ __apicdebuginit(void) print_IO_APIC(void)
if (!entry)
continue;
printk(KERN_DEBUG "IRQ%d ", irq);
- for (;;) {
+ for_each_irq_pin(entry, cfg->irq_2_pin)
printk("-> %d:%d", entry->apic, entry->pin);
- if (!entry->next)
- break;
- entry = entry->next;
- }
printk("\n");
}
@@ -2227,7 +2224,7 @@ static void __target_IO_APIC_irq(unsigned int irq, unsigned int dest, struct irq
struct irq_pin_list *entry;
u8 vector = cfg->vector;
- for (entry = cfg->irq_2_pin; entry != NULL; entry = entry->next) {
+ for_each_irq_pin(entry, cfg->irq_2_pin) {
unsigned int reg;
apic = entry->apic;
@@ -2556,20 +2553,10 @@ static void ack_apic_level(unsigned int irq)
#ifdef CONFIG_INTR_REMAP
static void __eoi_ioapic_irq(unsigned int irq, struct irq_cfg *cfg)
{
- int apic, pin;
struct irq_pin_list *entry;
- entry = cfg->irq_2_pin;
- for (;;) {
-
- if (!entry)
- break;
-
- apic = entry->apic;
- pin = entry->pin;
- io_apic_eoi(apic, pin);
- entry = entry->next;
- }
+ for_each_irq_pin(entry, cfg->irq_2_pin)
+ io_apic_eoi(entry->apic, entry->pin);
}
static void
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [tip:x86/apic] x86, ioapic: Throw BUG instead of NULL dereference
2009-08-01 7:48 ` [rfc 2/2] x86,ioapic: throw BUG instead of NULL dereference Cyrill Gorcunov
2009-08-04 14:16 ` [tip:x86/apic] x86, ioapic: Throw " tip-bot for Cyrill Gorcunov
@ 2009-08-05 10:55 ` tip-bot for Cyrill Gorcunov
1 sibling, 0 replies; 8+ messages in thread
From: tip-bot for Cyrill Gorcunov @ 2009-08-05 10:55 UTC (permalink / raw)
To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, gorcunov, tglx, mingo
Commit-ID: a7428cd2ef77734465e36bceb43290e37e2a97c6
Gitweb: http://git.kernel.org/tip/a7428cd2ef77734465e36bceb43290e37e2a97c6
Author: Cyrill Gorcunov <gorcunov@openvz.org>
AuthorDate: Sat, 1 Aug 2009 11:48:00 +0400
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 5 Aug 2009 10:30:50 +0200
x86, ioapic: Throw BUG instead of NULL dereference
Instead of plain NULL deref we better throw error
message with a backtrace. Actually we need more
gracious error handling here. Meanwhile leave it
as is.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: yinghai@kernel.org
LKML-Reference: <20090801075435.769301745@openvz.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
arch/x86/kernel/apic/io_apic.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index ffd8fdf..2a145d3 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -503,6 +503,10 @@ static void add_pin_to_irq_node(struct irq_cfg *cfg, int node, int apic, int pin
}
entry = get_one_free_irq_2_pin(node);
+ if (!entry) {
+ printk(KERN_ERR "can not alloc irq_pin_list\n");
+ BUG_ON(1);
+ }
entry->apic = apic;
entry->pin = pin;
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2009-08-05 10:55 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-01 7:47 [rfc 0/2] x86,ioapic simplification,bugfix Cyrill Gorcunov
2009-08-01 7:47 ` [rfc 1/2] x86,ioapic: introduce for_each_irq_pin helper Cyrill Gorcunov
2009-08-04 14:11 ` Ingo Molnar
2009-08-04 14:16 ` [tip:x86/apic] x86, ioapic: Introduce for_each_irq_pin() helper tip-bot for Cyrill Gorcunov
2009-08-05 10:55 ` tip-bot for Cyrill Gorcunov
2009-08-01 7:48 ` [rfc 2/2] x86,ioapic: throw BUG instead of NULL dereference Cyrill Gorcunov
2009-08-04 14:16 ` [tip:x86/apic] x86, ioapic: Throw " tip-bot for Cyrill Gorcunov
2009-08-05 10:55 ` tip-bot for Cyrill Gorcunov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox