driver-core: platform: Catch errors from calls to irq_get_irq_data
PATCH 1/1 driver-core: platform: Catch errors from calls to irq_get_irq_data
irq_get_irq_data() can return NULL, which results in a nasty crash. Check its return value before passing it on to irqd_set_trigger_type().
--- drivers/base/platform.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/base/platform.c +8 -3
@@ -108,9 +108,14 @@ int platform_get_irq(struct platform_device *dev, unsigned int num)* IORESOURCE_BITS correspond 1-to-1 to the IRQF_TRIGGER* * settings. */ -if (r && r->flags &IORESOURCE_BITS ) -irqd_set_trigger_type (irq_get_irq_data (r->start), - r->flags &IORESOURCE_BITS ); +if (r && r->flags &IORESOURCE_BITS ) { +struct irq_data *irqd; + + irqd =irq_get_irq_data (r->start); +if (!irqd) +return -ENXIO ; +irqd_set_trigger_type (irqd, r->flags &IORESOURCE_BITS ); + }return r ? r->start : -ENXIO ;#endif
Signature · 1 line
2.5.0
Quoted 4 lines · Guenter Roeck
irq_get_irq_data()can return NULL, which results in a nasty crash. Check its return value before passing it on toirqd_set_trigger_type().Signed-off-by Guenter Roeck <[email protected]>
Should probably be tagged for stable.
Yours,
Linus Walleij
Greg Kroah-Hartman
maintainerQuoted 10 lines · Linus Walleij
Quoted 4 lines · Guenter Roeck
irq_get_irq_data()can return NULL, which results in a nasty crash. Check its return value before passing it on toirqd_set_trigger_type().Signed-off-by Guenter Roeck <[email protected]>Reviewed-by Linus Walleij <[email protected]>Should probably be tagged for stable.
Why, are there any systems that are currently broken without this change right now?
thanks,
greg k-h
Quoted 6 lines · Greg Kroah-Hartman
Quoted 5 lines · Linus Walleij
Quoted 3 lines · Guenter Roeck
irq_get_irq_data()can return NULL, which results in a nasty crash. Check its return value before passing it on toirqd_set_trigger_type().
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Signed-off-by Guenter Roeck <[email protected]>Reviewed-by Linus Walleij <[email protected]>Should probably be tagged for stable.
Why, are there any systems that are currently broken without this change right now?
I guess Günther can tell if there are any, but I guess you're right, no need to rush it for stable then.
Yours,
Linus Walleij
Quoted 6 lines · Greg Kroah-Hartman
Quoted 5 lines · Linus Walleij
Quoted 3 lines · Guenter Roeck
irq_get_irq_data()can return NULL, which results in a nasty crash. Check its return value before passing it on toirqd_set_trigger_type().
Quoted 9 lines
Quoted 5 lines
Quoted 1 line
Signed-off-by Guenter Roeck <[email protected]>Reviewed-by Linus Walleij <[email protected]>Should probably be tagged for stable.
Why, are there any systems that are currently broken without this change right now?
I only see it in -next, and that is due to a patch there.
Guenter