* [PATCH] rtc: Fix possible null pointer dereference in rtc-mpc5121.c
@ 2012-04-24 20:43 John Stultz
2012-04-26 9:23 ` [tip:timers/urgent] " tip-bot for John Stultz
0 siblings, 1 reply; 2+ messages in thread
From: John Stultz @ 2012-04-24 20:43 UTC (permalink / raw)
To: LKML; +Cc: John Stultz, Thomas Gleixner
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* [tip:timers/urgent] rtc: Fix possible null pointer dereference in rtc-mpc5121.c
2012-04-24 20:43 [PATCH] rtc: Fix possible null pointer dereference in rtc-mpc5121.c John Stultz
@ 2012-04-26 9:23 ` tip-bot for John Stultz
0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for John Stultz @ 2012-04-26 9:23 UTC (permalink / raw)
To: linux-tip-commits; +Cc: linux-kernel, john.stultz, hpa, mingo, tglx
Commit-ID: e48b5e825f9c471cbcbfd934a4c2df27e9d39635
Gitweb: http://git.kernel.org/tip/e48b5e825f9c471cbcbfd934a4c2df27e9d39635
Author: John Stultz <john.stultz@linaro.org>
AuthorDate: Tue, 24 Apr 2012 13:43:35 -0700
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Thu, 26 Apr 2012 11:17:01 +0200
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>
---
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;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-04-26 9:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-24 20:43 [PATCH] rtc: Fix possible null pointer dereference in rtc-mpc5121.c John Stultz
2012-04-26 9:23 ` [tip:timers/urgent] " tip-bot for John Stultz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome