[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110614070732.GA3355@maxin>
Date: Tue, 14 Jun 2011 10:07:32 +0300
From: Maxin B John <maxin.john@...il.com>
To: akpm@...ux-foundation.org
Cc: segooon@...il.com, jkosina@...e.cz, tj@...nel.org,
tglx@...utronix.de, eike-kernel@...tec.de,
linux-kernel@...r.kernel.org
Subject: [PATCH] [RESEND] devres: Fix possible use after free
A freed pointer is passed as an argument to the function "devres_destroy()" in
"kernel/irq/devres.c" and "lib/devres.c". This patch fixes the possible use
after free.
It's notabug at this time, but the code is dangerous.
Signed-off-by: Maxin B. John <maxin.john@...il.com>
Reviewed-by: Rolf Eike Beer <eike-kernel@...tec.de>
Acked-by: Tejun Heo <tj@...nel.org>
---
diff --git a/kernel/irq/devres.c b/kernel/irq/devres.c
index 1ef4ffc..bd8e788 100644
--- a/kernel/irq/devres.c
+++ b/kernel/irq/devres.c
@@ -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);
diff --git a/lib/devres.c b/lib/devres.c
index 6efddf5..7c0e953 100644
--- a/lib/devres.c
+++ b/lib/devres.c
@@ -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);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists