devres: fix possible use after free
[linux-2.6.git] / kernel / irq / devres.c
index 1ef4ffc..bd8e788 100644 (file)
@@ -87,8 +87,8 @@ void devm_free_irq(struct device *dev, unsigned int irq, void *dev_id)
 {
        struct irq_devres match_data = { irq, dev_id };
 
-       free_irq(irq, dev_id);
        WARN_ON(devres_destroy(dev, devm_irq_release, devm_irq_match,
                               &match_data));
+       free_irq(irq, dev_id);
 }
 EXPORT_SYMBOL(devm_free_irq);