public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alessandro Zummo <alessandro.zummo@towertech.it>
To: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
Cc: linux-kernel@vger.kernel.org,
	David Brownell <david-b@pacbell.net>,
	rtc-linux@googlegroups.com
Subject: Re: rtc_cmos oops in cmos_rtc_ioctl
Date: Tue, 22 Sep 2009 12:40:41 +0200	[thread overview]
Message-ID: <20090922124041.62abee25@i1501.lan.towertech.it> (raw)
In-Reply-To: <200909211553.38409.herton@mandriva.com.br>

On Mon, 21 Sep 2009 15:53:38 -0300
Herton Ronaldo Krzesinski <herton@mandriva.com.br> wrote:

> The problem here is the rtc char device being created early and acessible before
> rtc_cmos does dev_set_drvdata(dev, &cmos_rtc), so dev_get_drvdata in
> cmos_rtc_ioctl can return null, like in this example where hwclock is run right
> after char device creation that triggers the udev rule:
> ACTION=="add", SUBSYSTEM=="rtc", RUN+="/sbin/hwclock --hctosys --rtc=/dev/%k"
> And makes the oops possible, in this case hwclock looks to open and close the
> device fast enough.

 right. the best option would be to use the new irq api that was
 introduced after the creation of rtc_cmos (and thus remove the whole
 ioctl routine).

 [...]

> But I saw another issue: looks it could be possible that as cmos_rtc_ioctl
> (ioctl) can be run before rtc_device_register returns, the following call chain
> could happen in current code:
> cmos_rtc_ioctl->cmos_irq_{en,dis}able->cmos_checkintr->rtc_update_irq
> rtc_update_irq uses cmos->rtc, which is set only at return of
> rtc_device_register, and here we may have another problem... is it
> possible?

 this shouldn't happen, irqs are enabled only after everything
 has been setup to handle them.

 

-- 

 Best regards,

 Alessandro Zummo,
  Tower Technologies - Torino, Italy

  http://www.towertech.it


  reply	other threads:[~2009-09-22 10:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-21 18:53 rtc_cmos oops in cmos_rtc_ioctl Herton Ronaldo Krzesinski
2009-09-22 10:40 ` Alessandro Zummo [this message]
2009-09-22 18:15   ` Herton Ronaldo Krzesinski
2009-09-22 19:15     ` [rtc-linux] " Alessandro Zummo
2009-09-30 18:59       ` Andrew Morton

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=20090922124041.62abee25@i1501.lan.towertech.it \
    --to=alessandro.zummo@towertech.it \
    --cc=david-b@pacbell.net \
    --cc=herton@mandriva.com.br \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rtc-linux@googlegroups.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