From: Pavel Emelyanov <xemul@openvz.org>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Andrew Morton <akpm@osdl.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
devel@openvz.org
Subject: Re: [PATCH] Fix potential OOPS in generic_setlease()
Date: Thu, 20 Sep 2007 12:38:48 +0400 [thread overview]
Message-ID: <46F23198.6070004@openvz.org> (raw)
In-Reply-To: <20070919193001.GH5946@fieldses.org>
J. Bruce Fields wrote:
> On Wed, Sep 19, 2007 at 06:26:05PM +0400, Pavel Emelyanov wrote:
>> This code is run under lock_kernel(), which is dropped during
>> sleeping operations, so the following race is possible:
>>
>> CPU1: CPU2:
>> vfs_setlease(); vfs_setlease();
>> lock_kernel();
>> lock_kernel(); /* spin */
>> generic_setlease():
>> ...
>> for (before = ...)
>> /* here we found some lease after
>> * which we will insert the new one
>> */
>> fl = locks_alloc_lock();
>> /* go to sleep in this allocation and
>> * drop the BKL
>> */
>> generic_setlease():
>> ...
>> for (before = ...)
>> /* here we find the "before" pointing
>> * at the one we found on CPU1
>> */
>> ->fl_change(my_before, arg);
>> lease_modify();
>> locks_free_lock();
>> /* and we freed it */
>> ...
>> unlock_kernel();
>> locks_insert_lock(before, fl);
>> /* OOPS! We have just tried to add the lease
>> * at the tail of already removed one
>> */
>
> Thanks for spotting this!
>
> But--careful-- it looks like "fl" is also used as a temporary variable
> in a loop between the new and old location of that allocation. Isn't
> that a bug?
OOPS! Good catch, thanks. I will resend the patch shortly.
prev parent reply other threads:[~2007-09-20 8:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-19 14:26 [PATCH] Fix potential OOPS in generic_setlease() Pavel Emelyanov
2007-09-19 19:30 ` J. Bruce Fields
2007-09-20 8:38 ` Pavel Emelyanov [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=46F23198.6070004@openvz.org \
--to=xemul@openvz.org \
--cc=akpm@osdl.org \
--cc=bfields@fieldses.org \
--cc=devel@openvz.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