* [PATCH] rtc: tps65910: Fix potential NULL-pointer dereference
@ 2014-08-05 11:35 Thierry Reding
0 siblings, 0 replies; only message in thread
From: Thierry Reding @ 2014-08-05 11:35 UTC (permalink / raw)
To: Andrew Morton; +Cc: Alessandro Zummo, rtc-linux, linux-kernel
From: Thierry Reding <treding@nvidia.com>
The interrupt handler gets the driver data associated with the RTC
device and doesn't check it for validity. This can cause a NULL pointer
being dereferenced when and interrupt fires before the driver data was
properly set up.
Fix this by setting the driver data earlier (before the interrupt is
requested).
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
drivers/rtc/rtc-tps65910.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/rtc/rtc-tps65910.c b/drivers/rtc/rtc-tps65910.c
index 7af00208d637..2583349fbde5 100644
--- a/drivers/rtc/rtc-tps65910.c
+++ b/drivers/rtc/rtc-tps65910.c
@@ -258,6 +258,8 @@ static int tps65910_rtc_probe(struct platform_device *pdev)
if (ret < 0)
return ret;
+ platform_set_drvdata(pdev, tps_rtc);
+
irq = platform_get_irq(pdev, 0);
if (irq <= 0) {
dev_warn(&pdev->dev, "Wake up is not possible as irq = %d\n",
@@ -283,8 +285,6 @@ static int tps65910_rtc_probe(struct platform_device *pdev)
return ret;
}
- platform_set_drvdata(pdev, tps_rtc);
-
return 0;
}
--
2.0.4
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-08-05 11:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-05 11:35 [PATCH] rtc: tps65910: Fix potential NULL-pointer dereference Thierry Reding
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®