From: Hareesh Nagarajan <hnagar2@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: Potentially racy del_timer(&timer); ... ; add_timer(&timer) sequence
Date: Sat, 28 Jan 2006 23:41:27 -0600 [thread overview]
Message-ID: <43DC5587.9010908@gmail.com> (raw)
I was going through the kernel sources looking for places where the
following sequence occurs:
del_timer(&timer);
... modify timer ...
add_timer(&timer)
To my surprise, I found numerous place where such code appears. I
figured this kind of code will always be (potentially) racy on SMP machines.
Examples are:
1. net/lapb/lapb_timer.c
void lapb_start_t1timer(struct lapb_cb *lapb)
{
del_timer(&lapb->t1timer);
lapb->t1timer.data = (unsigned long)lapb;
lapb->t1timer.function = &lapb_t1timer_expiry;
lapb->t1timer.expires = jiffies + lapb->t1;
add_timer(&lapb->t1timer);
}
mod_timer could have been used.
2. arch/i386/mach-voyager/voyager_thread.c
3. kernel/acct.c
del_timer(&acct_globals.timer);
acct_globals.needcheck = 0;
acct_globals.timer.expires = jiffies + ACCT_TIMEOUT*HZ;
add_timer(&acct_globals.timer);
Would anyone on LKML interested in getting this cleaned up? I could do
it, if it would be useful. Or perhaps someone on Kernel Janitors is
already working on it.
Thanks,
Hareesh Nagarajan
www.cs.uic.edu/~hnagaraj
reply other threads:[~2006-01-29 5:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=43DC5587.9010908@gmail.com \
--to=hnagar2@gmail.com \
--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