summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevendra Naga <devendra.aaru@gmail.com>2012-07-11 14:01:53 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-07-16 09:04:44 -0700
commit0bf51a8f8756511b382aac13a3c1c7abeb8b0bec (patch)
treea86c6510d43a1ca4a5d876f5e381510ccb591dfa
parent0e343dbe08acb440f7914d989bcc32c1d1576735 (diff)
downloadkernel-adaptation-pc-0bf51a8f8756511b382aac13a3c1c7abeb8b0bec.tar.gz
kernel-adaptation-pc-0bf51a8f8756511b382aac13a3c1c7abeb8b0bec.tar.bz2
kernel-adaptation-pc-0bf51a8f8756511b382aac13a3c1c7abeb8b0bec.zip
drivers/rtc/rtc-spear.c: fix use-after-free in spear_rtc_remove()
commit 2a643893e50fde71d7ba84b5592ec61b467b9ab6 upstream. `config' is freed and is then used in the rtc_device_unregister() call, causing a kernel panic. Signed-off-by: Devendra Naga <devendra.aaru@gmail.com> Reviewed-by: Viresh Kumar <viresh.linux@gmail.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/rtc/rtc-spear.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/rtc/rtc-spear.c b/drivers/rtc/rtc-spear.c
index e38da0dc418..235b0efaa34 100644
--- a/drivers/rtc/rtc-spear.c
+++ b/drivers/rtc/rtc-spear.c
@@ -457,12 +457,12 @@ static int __devexit spear_rtc_remove(struct platform_device *pdev)
clk_disable(config->clk);
clk_put(config->clk);
iounmap(config->ioaddr);
- kfree(config);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (res)
release_mem_region(res->start, resource_size(res));
platform_set_drvdata(pdev, NULL);
rtc_device_unregister(config->rtc);
+ kfree(config);
return 0;
}