In __rtc_set_alarm(), the error after __rtc_read_time() is not checked.
If rtc device fail to read time, we cannot guarantee the following process.
Add the verification code for returned __rtc_read_time() error.
Signed-off-by: Hyogi Gim <[email protected]>
---
drivers/rtc/interface.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index 5813fa5..5b2717f 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -348,6 +348,8 @@ static int __rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
/* Make sure we're not setting alarms in the past */
err = __rtc_read_time(rtc, &tm);
+ if (err)
+ return err;
rtc_tm_to_time(&tm, &now);
if (scheduled <= now)
return -ETIME;
--
1.8.3.2
On Fri, 4 Jul 2014 10:22:26 +0900
Hyogi Gim <[email protected]> wrote:
> In __rtc_set_alarm(), the error after __rtc_read_time() is not checked.
> If rtc device fail to read time, we cannot guarantee the following process.
>
> Add the verification code for returned __rtc_read_time() error.
>
> Signed-off-by: Hyogi Gim <[email protected]>
Acked-by: Alessandro Zummo <[email protected]>
--
Best regards,
Alessandro Zummo,
Tower Technologies - Torino, Italy
http://www.towertech.it
On Thu, Jul 3, 2014 at 6:22 PM, Hyogi Gim <[email protected]> wrote:
> In __rtc_set_alarm(), the error after __rtc_read_time() is not checked.
> If rtc device fail to read time, we cannot guarantee the following process.
>
> Add the verification code for returned __rtc_read_time() error.
>
> Signed-off-by: Hyogi Gim <[email protected]>
Thanks for sending this in. Sorry I didn't get to it earlier. I've got
it queued for testing and hopefully will make it for 3.17 (but I may
be cutting it close).
thanks
-john