aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-mpc5121.c
diff options
context:
space:
mode:
authorJohn Stultz <john.stultz@linaro.org>2012-04-24 16:43:35 -0400
committerThomas Gleixner <tglx@linutronix.de>2012-04-26 05:17:01 -0400
commite48b5e825f9c471cbcbfd934a4c2df27e9d39635 (patch)
tree4c2d4ce64bcd7ee61a2bbc209299f6678549f17a /drivers/rtc/rtc-mpc5121.c
parenta6371f80230eaaafd7eef7efeedaa9509bdc982d (diff)
rtc: Fix possible null pointer dereference in rtc-mpc5121.c
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. Reported by: Mark Lord <kernel@teksavvy.com> Signed-off-by: John Stultz <john.stultz@linaro.org> Link: http://lkml.kernel.org/r/1335300215-21427-1-git-send-email-john.stultz@linaro.org Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'drivers/rtc/rtc-mpc5121.c')
-rw-r--r--drivers/rtc/rtc-mpc5121.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/rtc/rtc-mpc5121.c b/drivers/rtc/rtc-mpc5121.c
index 42f5f829b3ee..029e421baaed 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)
360 &mpc5200_rtc_ops, THIS_MODULE); 360 &mpc5200_rtc_ops, THIS_MODULE);
361 } 361 }
362 362
363 rtc->rtc->uie_unsupported = 1;
364
365 if (IS_ERR(rtc->rtc)) { 363 if (IS_ERR(rtc->rtc)) {
366 err = PTR_ERR(rtc->rtc); 364 err = PTR_ERR(rtc->rtc);
367 goto out_free_irq; 365 goto out_free_irq;
368 } 366 }
367 rtc->rtc->uie_unsupported = 1;
369 368
370 return 0; 369 return 0;
371 370