linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "홍신 shin hong" <hongshin@gmail.com>
To: linux-fsdevel@vger.kernel.org
Subject: BUG? a suspected race bug at alloc_fd()
Date: Fri, 7 Aug 2009 13:55:10 +0900	[thread overview]
Message-ID: <2014bcab0908062155n6973cb7cg43bc5dcb19261a72@mail.gmail.com> (raw)

Hi.  I am reporting a suspected race bug at alloc_fd() in Linux 2.6.30.4.

In alloc_fd(), spin_lock(&files->file_lock) synchronizes
the execution of its gurading code block(line 448~486 at fs/file.c).

However, by invocation of expand_files() at line 458,
spin_lock(&file->file_lock) can be released and re-taken
since expand_files() invokes expand_fdtable() and expand_fdtable()
release &files->file_lock and re-take the lock (line 206~208).

For this reason, the execution of alloc_fd() might result race condition
if other threads are scheduled between the lock releasing and re-taking.

Please examine the code and let me know your opinion.
Thank you.

Sincerely
Shin Hong

             reply	other threads:[~2009-08-07  4:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-07  4:55 홍신 shin hong [this message]
2009-08-07 11:08 ` BUG? a suspected race bug at alloc_fd() Matthew Wilcox

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=2014bcab0908062155n6973cb7cg43bc5dcb19261a72@mail.gmail.com \
    --to=hongshin@gmail.com \
    --cc=linux-fsdevel@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;
as well as URLs for NNTP newsgroup(s).