linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers/rtc/interface.c: check the error after __rtc_read_time()
@ 2014-07-04  1:22 Hyogi Gim
  2014-07-04 10:10 ` [rtc-linux] " Alessandro Zummo
  2014-07-30 17:44 ` John Stultz
  0 siblings, 2 replies; 3+ messages in thread
From: Hyogi Gim @ 2014-07-04  1:22 UTC (permalink / raw)
  To: Alessandro Zummo, John Stultz; +Cc: rtc-linux, linux-kernel, Hyogi Gim

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 <hyogi.gim@lge.com>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [rtc-linux] [PATCH] drivers/rtc/interface.c: check the error after __rtc_read_time()
  2014-07-04  1:22 [PATCH] drivers/rtc/interface.c: check the error after __rtc_read_time() Hyogi Gim
@ 2014-07-04 10:10 ` Alessandro Zummo
  2014-07-30 17:44 ` John Stultz
  1 sibling, 0 replies; 3+ messages in thread
From: Alessandro Zummo @ 2014-07-04 10:10 UTC (permalink / raw)
  To: Hyogi Gim; +Cc: John Stultz, rtc-linux, linux-kernel, akpm

On Fri,  4 Jul 2014 10:22:26 +0900
Hyogi Gim <hyogi.gim@lge.com> 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 <hyogi.gim@lge.com>

 Acked-by: Alessandro Zummo <a.zummo@towertech.it>

-- 

 Best regards,

 Alessandro Zummo,
  Tower Technologies - Torino, Italy

  http://www.towertech.it


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drivers/rtc/interface.c: check the error after __rtc_read_time()
  2014-07-04  1:22 [PATCH] drivers/rtc/interface.c: check the error after __rtc_read_time() Hyogi Gim
  2014-07-04 10:10 ` [rtc-linux] " Alessandro Zummo
@ 2014-07-30 17:44 ` John Stultz
  1 sibling, 0 replies; 3+ messages in thread
From: John Stultz @ 2014-07-30 17:44 UTC (permalink / raw)
  To: Hyogi Gim; +Cc: Alessandro Zummo, rtc-linux@googlegroups.com, lkml

On Thu, Jul 3, 2014 at 6:22 PM, Hyogi Gim <hyogi.gim@lge.com> 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 <hyogi.gim@lge.com>

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-07-30 17:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-04  1:22 [PATCH] drivers/rtc/interface.c: check the error after __rtc_read_time() Hyogi Gim
2014-07-04 10:10 ` [rtc-linux] " Alessandro Zummo
2014-07-30 17:44 ` John Stultz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).