devres: fix possible use after free
[linux-2.6.git] / lib / devres.c
index 6efddf5..7c0e953 100644 (file)
@@ -79,9 +79,9 @@ EXPORT_SYMBOL(devm_ioremap_nocache);
  */
 void devm_iounmap(struct device *dev, void __iomem *addr)
 {
-       iounmap(addr);
        WARN_ON(devres_destroy(dev, devm_ioremap_release, devm_ioremap_match,
                               (void *)addr));
+       iounmap(addr);
 }
 EXPORT_SYMBOL(devm_iounmap);