lkml.org 
[lkml]   [2012]   [Apr]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] rtc: Fix possible null pointer dereference in rtc-mpc5121.c
Date
Hey Thomas,
This is against tip/timers/urgent for 3.4
thanks
-john

Mark Loard pointed out:
"For example, this beauty from rtc-mpc5121.c in the same update:
...
rtc->rtc = rtc_device_register("mpc5200-rtc", &op->dev,
&mpc5200_rtc_ops, THIS_MODULE);
...

rtc->rtc->uie_unsupported = 1; // <<<< Ooops NULL pointer >>>>

if (IS_ERR(rtc->rtc)) { // <<<< this needs to be earlier >>>>
err = PTR_ERR(rtc->rtc);
goto out_free_irq;
}
..."
This patch moves setting the uie_unsupported flag to after
we validate the rtc->rtc pointer to resolve this.

CC: Thomas Gleixner <tglx@linutronix.de>
Reported by: Mark Lord <kernel@teksavvy.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
drivers/rtc/rtc-mpc5121.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-mpc5121.c b/drivers/rtc/rtc-mpc5121.c
index 42f5f82..029e421 100644
--- a/drivers/rtc/rtc-mpc5121.c
+++ b/drivers/rtc/rtc-mpc5121.c
@@ -360,12 +360,11 @@ static int __devinit mpc5121_rtc_probe(struct platform_device *op)
&mpc5200_rtc_ops, THIS_MODULE);
}

- rtc->rtc->uie_unsupported = 1;
-
if (IS_ERR(rtc->rtc)) {
err = PTR_ERR(rtc->rtc);
goto out_free_irq;
}
+ rtc->rtc->uie_unsupported = 1;

return 0;

--
1.7.3.2.146.gca209


\
 
 \ /
  Last update: 2012-04-24 22:49    [W:2.134 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site