From: Linus Torvalds <torvalds@linux-foundation.org>
To: Eric Paris <eparis@redhat.com>
Cc: Christoph Thielecke <christoph.thielecke@gmx.de>,
Andrew Morton <akpm@linux-foundation.org>,
Al Viro <viro@ZenIV.linux.org.uk>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
"Rafael J. Wysocki" <rjw@sisk.pl>
Subject: Re: kernel bugs 2.6.31-rc6
Date: Sat, 15 Aug 2009 10:52:39 -0700 (PDT) [thread overview]
Message-ID: <alpine.LFD.2.01.0908151036290.3162@localhost.localdomain> (raw)
In-Reply-To: <alpine.LFD.2.01.0908150957060.3162@localhost.localdomain>
On Sat, 15 Aug 2009, Linus Torvalds wrote:
>
> For example, fsnotify_remove_priv_from_event() will remove the private
> data event from the list, but what if there are _multiple_ entries with
> the same 'group' entry? If so, it will remove just the first one.
Hmm. Looking closer, that shouldn't much matter. Each time we added an
entry in private_data_list, we would have done a
'fsnotify_get_event(event)' due to adding it to the 'golder->event_list'.
That said, there does seem to be some dubious code there. For example,
in 'inotify_ignored_and_remove_idr()', we do this:
fsnotify_add_notify_event(group, ignored_event, fsn_event_priv);
/* did the private data get added? */
if (list_empty(&fsn_event_priv->event_list))
inotify_free_event_priv(fsn_event_priv);
and we do it without holding any locks at all. So as far as I can tell,
what could happen is that 'fsnotify_add_notify_event()' actually adds the
private event (fsn_event_priv), but then before we check that the
event_list is empty, another user (on another CPU, or preempted on the
same CPU - Christoph has both PREEMPT and SMP on) comes along, picks up
the private event and frees it (and re-uses it).
That looks like a pretty small window, but preemption could make it much
bigger. Who knows? Maybe there are other things like that.
And maybe I'm just full of sh*t, and the above can't even happen for some
reason I'm missing.
Linus
next prev parent reply other threads:[~2009-08-15 17:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200908151014.22910.christoph.thielecke@gmx.de>
2009-08-15 17:29 ` Linus Torvalds
2009-08-15 17:52 ` Linus Torvalds [this message]
2009-08-15 23:19 ` Eric Paris
2009-08-24 9:06 ` Zdenek Kabelac
2009-08-24 13:29 ` Eric Paris
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=alpine.LFD.2.01.0908151036290.3162@localhost.localdomain \
--to=torvalds@linux-foundation.org \
--cc=akpm@linux-foundation.org \
--cc=christoph.thielecke@gmx.de \
--cc=eparis@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rjw@sisk.pl \
--cc=viro@ZenIV.linux.org.uk \
/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®