From: Roland McGrath <roland@redhat.com>
To: Alexander Nyberg <alexn@dsv.su.se>
Cc: Andrew Morton <akpm@osdl.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Jeremy Fitzhardinge <jeremy@goop.org>
Subject: [PATCH] fix posix-timer initialization
Date: Wed, 23 Feb 2005 13:48:20 -0800 [thread overview]
Message-ID: <200502232148.j1NLmKAV030044@magilla.sf.frob.com> (raw)
In-Reply-To: Alexander Nyberg's message of Sunday, 20 February 2005 22:53:01 +0100 <1108936381.2272.20.camel@boxen>
> The problem arises from code touching the union in alloc_posix_timer()
> which makes firing go non-zero. When firing is checked in
> posix_cpu_timer_set() it will be positive causing an infinite loop.
>
> So either the below fix or preferably move the INIT_LIST_HEAD(x) from
> alloc_posix_timer() to somewhere later where it doesn't disturb the other
> union members.
Thanks for finding this problem. The latter is what I think is the right
solution. This patch does that, and also removes some superfluous rezeroing.
Thanks,
Roland
Signed-off-by: Roland McGrath <roland@redhat.com>
--- linux-2.6/kernel/posix-timers.c
+++ linux-2.6/kernel/posix-timers.c
@@ -221,9 +221,8 @@ static inline int common_clock_set(clock
static inline int common_timer_create(struct k_itimer *new_timer)
{
- new_timer->it.real.incr = 0;
+ INIT_LIST_HEAD(&new_timer->it.real.abs_timer_entry);
init_timer(&new_timer->it.real.timer);
- new_timer->it.real.timer.expires = 0;
new_timer->it.real.timer.data = (unsigned long) new_timer;
new_timer->it.real.timer.function = posix_timer_fn;
set_timer_inactive(new_timer);
@@ -564,7 +563,6 @@ static struct k_itimer * alloc_posix_tim
if (!tmr)
return tmr;
memset(tmr, 0, sizeof (struct k_itimer));
- INIT_LIST_HEAD(&tmr->it.real.abs_timer_entry);
if (unlikely(!(tmr->sigq = sigqueue_alloc()))) {
kmem_cache_free(posix_timers_cache, tmr);
tmr = NULL;
prev parent reply other threads:[~2005-02-23 21:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-19 9:19 2.6.11-rc3-mm2: lockup in sys_timer_settime Jeremy Fitzhardinge
2005-02-20 21:53 ` Alexander Nyberg
2005-02-23 21:48 ` Roland McGrath [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=200502232148.j1NLmKAV030044@magilla.sf.frob.com \
--to=roland@redhat.com \
--cc=akpm@osdl.org \
--cc=alexn@dsv.su.se \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®