From: wim@iguana.be (Wim Van Sebroeck)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] watchdog: fix error in probe() of s3c2410_wdt (reset at booting)
Date: Fri, 13 Jan 2012 22:45:55 +0100 [thread overview]
Message-ID: <20120113214555.GA19495@infomag.iguana.be> (raw)
In-Reply-To: <20120113111117.GT1068@n2100.arm.linux.org.uk>
Hi,
On Fri, Jan 13, 2012 at 11:11:17AM +0000, Russell King - ARM Linux wrote:
> On Fri, Jan 13, 2012 at 02:14:23PM +0900, MyungJoo Ham wrote:
> > Probe function of s3c2410 watchdog calls request_irq before initializing
> > required value (wdt_count). This incurs resetting watchdog counter value
> > and watchdog-reboot during booting up.
> >
> > This patch addresses such an issue by calling request_irq later.
> >
> > Error handling in probe function and calling oder in remove function are
> > also revised accordingly.
>
> On the other hand, this patch violates the general principle that you set
> the device up _before_ you publish it to userspace.
>
> In the case where you add the watchdog device, but then the subsequent
> request_irq() fails, there is a window where the watchdog device could
> be opened and started. You then fall out through the error paths, and
> the module could be removed.
>
> Don't do this. Always setup the device first. Then publish it. Never
> the other way around.
Russell was faster in replying, but I would have given the same NAK:
the registering of the watchdog means that userspace get access/control over
the watchdog device. So the request_irq should be done before that.
In your trouble description you wrote: "Probe function of s3c2410 watchdog
calls request_irq before initializing required value (wdt_count)."
Should we not fix the initialization of the wdt_count value instead of the
request_irq? i will have a look at the code somewhere this weekend.
Mvg,
Wim.
next prev parent reply other threads:[~2012-01-13 21:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-13 5:14 [PATCH] watchdog: fix error in probe() of s3c2410_wdt (reset at booting) MyungJoo Ham
2012-01-13 11:11 ` Russell King - ARM Linux
2012-01-13 21:45 ` Wim Van Sebroeck [this message]
2012-01-17 2:00 ` MyungJoo Ham
2012-01-30 19:01 ` Wim Van Sebroeck
2012-01-31 5:30 ` MyungJoo Ham
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=20120113214555.GA19495@infomag.iguana.be \
--to=wim@iguana.be \
--cc=linux-arm-kernel@lists.infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).