mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: Vaibhav Jain <vaibhav@linux.vnet.ibm.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>,
	rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org, linux-rtc@vger.kernel.org
Subject: Re: [PATCH] drivers/rtc/interface.c: Validate alarm-time before handling rollover
Date: Wed, 31 May 2017 13:05:58 +0200	[thread overview]
Message-ID: <20170531110558.tcvl42wvaeazmbgp@piout.net> (raw)
In-Reply-To: <20170519164855.11747-1-vaibhav@linux.vnet.ibm.com>

On 19/05/2017 at 22:18:55 +0530, Vaibhav Jain wrote:
> In function __rtc_read_alarm() its possible for an alarm time-stamp to
> be invalid even after replacing missing components with current
> time-stamp. The condition 'alarm->time.tm_year < 70' will trigger this
> case and will cause the call to 'rtc_tm_to_time64(&alarm->time)'
> return a negative value for variable t_alm.
> 
> While handling alarm rollover this negative t_alm (assumed to seconds
> offset from '1970-01-01 00:00:00') is converted back to rtc_time via
> rtc_time64_to_tm() which results in this error log with seemingly
> garbage values:
> 
> "rtc rtc0: invalid alarm value: -2-1--1041528741
> 2005511117:71582844:32"
> 
> This error was generated when the rtc driver (rtc-opal in this case)
> returned an alarm time-stamp of '00-00-00 00:00:00' to indicate that
> the alarm is disabled. Though I have submitted a separate fix for the
> rtc-opal driver, this issue may potentially impact other
> existing/future rtc drivers.
> 
> To fix this issue the patch validates the alarm time-stamp just after
> filling up the missing datetime components and if rtc_valid_tm() still
> reports it to be invalid then bails out of the function without
> handling the rollover.
> 
> Reported-by: Steve Best <sbest@redhat.com>
> Signed-off-by: Vaibhav Jain <vaibhav@linux.vnet.ibm.com>
> ---
>  drivers/rtc/interface.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
Applied, thanks.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

      reply	other threads:[~2017-05-31 11:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-19 16:48 Vaibhav Jain
2017-05-31 11:05 ` Alexandre Belloni [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170531110558.tcvl42wvaeazmbgp@piout.net \
    --to=alexandre.belloni@free-electrons.com \
    --cc=a.zummo@towertech.it \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=rtc-linux@googlegroups.com \
    --cc=vaibhav@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®