<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/git/stable/linux.git/fs/locks.c, branch linux-2.6.16.y</title>
<subtitle>Linux kernel stable tree</subtitle>
<id>https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/atom?h=linux-2.6.16.y</id>
<link rel='self' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/atom?h=linux-2.6.16.y'/>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/'/>
<updated>2008-07-14T18:09:23+00:00</updated>
<entry>
<title>fix SMP ordering hole in fcntl_setlk() (CVE-2008-1669)</title>
<updated>2008-07-14T18:09:23+00:00</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2008-07-14T18:09:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=89ebd169dd1e8be2c11c100c4decbffdcbd6466b'/>
<id>urn:sha1:89ebd169dd1e8be2c11c100c4decbffdcbd6466b</id>
<content type='text'>
fcntl_setlk()/close() race prevention has a subtle hole - we need to
make sure that if we *do* have an fcntl/close race on SMP box, the
access to descriptor table and inode-&gt;i_flock won't get reordered.

As it is, we get STORE inode-&gt;i_flock, LOAD descriptor table entry vs.
STORE descriptor table entry, LOAD inode-&gt;i_flock with not a single
lock in common on both sides.  We do have BKL around the first STORE,
but check in locks_remove_posix() is outside of BKL and for a good
reason - we don't want BKL on common path of close(2).

Solution is to hold -&gt;file_lock around fcheck() in there; that orders
us wrt removal from descriptor table that preceded locks_remove_posix()
on close path and we either come first (in which case eviction will be
handled by the close side) or we'll see the effect of close and do
eviction ourselves.  Note that even though it's read-only access,
we do need -&gt;file_lock here - rcu_read_lock() won't be enough to
order the things.

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Signed-off-by: Adrian Bunk &lt;bunk@kernel.org&gt;
</content>
</entry>
<entry>
<title>fcntl(F_SETSIG) fix</title>
<updated>2006-12-04T18:43:11+00:00</updated>
<author>
<name>Trond Myklebust</name>
<email>Trond.Myklebust@netapp.com</email>
</author>
<published>2006-12-04T18:43:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=25e1dd8a73c6661c03104f53199b501be489888d'/>
<id>urn:sha1:25e1dd8a73c6661c03104f53199b501be489888d</id>
<content type='text'>
fcntl(F_SETSIG) no longer works on leases because
lease_release_private_callback() gets called as the lease is copied in
order to initialise it.

The problem is that lease_alloc() performs an unnecessary initialisation,
which sets the lease_manager_ops.  Avoid the problem by allocating the
target lease structure using locks_alloc_lock().

Signed-off-by: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
Signed-off-by: Adrian Bunk &lt;bunk@stusta.de&gt;
</content>
</entry>
<entry>
<title>[PATCH] fs/locks.c: Fix sys_flock() race</title>
<updated>2006-05-20T22:00:29+00:00</updated>
<author>
<name>Trond Myklebust</name>
<email>Trond.Myklebust@netapp.com</email>
</author>
<published>2006-03-31T10:30:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=cad6178cd651b9604dc9433407a5be8ed71c4914'/>
<id>urn:sha1:cad6178cd651b9604dc9433407a5be8ed71c4914</id>
<content type='text'>
sys_flock() currently has a race which can result in a double free in the
multi-thread case.

Thread 1			Thread 2

sys_flock(file, LOCK_EX)
				sys_flock(file, LOCK_UN)

If Thread 2 removes the lock from inode-&gt;i_lock before Thread 1 tests for
list_empty(&amp;lock-&gt;fl_link) at the end of sys_flock, then both threads will
end up calling locks_free_lock for the same lock.

Fix is to make flock_lock_file() do the same as posix_lock_file(), namely
to make a copy of the request, so that the caller can always free the lock.

This also has the side-effect of fixing up a reference problem in the
lockd handling of flock.

Signed-off-by: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
Signed-off-by: Chris Wright &lt;chrisw@sous-sol.org&gt;
</content>
</entry>
<entry>
<title>[PATCH] fs/locks.c: Fix lease_init (CVE-2006-1860)</title>
<updated>2006-05-11T01:56:15+00:00</updated>
<author>
<name>Trond Myklebust</name>
<email>Trond.Myklebust@netapp.com</email>
</author>
<published>2006-05-08T03:02:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=1f0e637c94a9b041833947c79110d6c02fff8618'/>
<id>urn:sha1:1f0e637c94a9b041833947c79110d6c02fff8618</id>
<content type='text'>
It is insane to be giving lease_init() the task of freeing the lock it is
supposed to initialise, given that the lock is not guaranteed to be
allocated on the stack. This causes lockups in fcntl_setlease().
Problem diagnosed by Daniel Hokka Zakrisson &lt;daniel@hozac.com&gt;

Also fix a slab leak in __setlease() due to an uninitialised return value.
Problem diagnosed by BjÃ¶rn Steinbrink.

Signed-off-by: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
Tested-by: Daniel Hokka Zakrisson &lt;daniel@hozac.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
Cc: Björn Steinbrink &lt;B.Steinbrink@gmx.de&gt;
Signed-off-by: Chris Wright &lt;chrisw@sous-sol.org&gt;
</content>
</entry>
<entry>
<title>[PATCH] Fix file lookup without ref</title>
<updated>2006-04-24T16:56:05+00:00</updated>
<author>
<name>Dipankar Sarma</name>
<email>dipankar@in.ibm.com</email>
</author>
<published>2006-04-19T17:00:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=95fb678bf90572414b1c2f239c6a44226049ba8a'/>
<id>urn:sha1:95fb678bf90572414b1c2f239c6a44226049ba8a</id>
<content type='text'>
There are places in the kernel where we look up files in fd tables and
access the file structure without holding refereces to the file.  So, we
need special care to avoid the race between looking up files in the fd
table and tearing down of the file in another CPU.  Otherwise, one might
see a NULL f_dentry or such torn down version of the file.  This patch
fixes those special places where such a race may happen.

Signed-off-by: Dipankar Sarma &lt;dipankar@in.ibm.com&gt;
Acked-by: "Paul E. McKenney" &lt;paulmck@us.ibm.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</content>
</entry>
<entry>
<title>[PATCH] tiny: Uninline some fslocks.c functions</title>
<updated>2006-01-09T04:14:10+00:00</updated>
<author>
<name>Matt Mackall</name>
<email>mpm@selenic.com</email>
</author>
<published>2006-01-08T09:05:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=33443c42f4ffa5ca23b3323234bcb1a78e85d9db'/>
<id>urn:sha1:33443c42f4ffa5ca23b3323234bcb1a78e85d9db</id>
<content type='text'>
uninline some file locking functions

add/remove: 3/0 grow/shrink: 0/15 up/down: 256/-1525 (-1269)
function                                     old     new   delta
locks_free_lock                                -     134    +134
posix_same_owner                               -      69     +69
__locks_delete_block                           -      53     +53
posix_locks_conflict                         126     108     -18
locks_remove_posix                           266     237     -29
locks_wake_up_blocks                         121      87     -34
locks_block_on_timeout                        83      47     -36
locks_insert_block                           157     120     -37
locks_delete_block                            62      23     -39
posix_unblock_lock                           104      59     -45
posix_locks_deadlock                         162     100     -62
locks_delete_lock                            228     119    -109
sys_flock                                    338     217    -121
__break_lease                                600     474    -126
lease_init                                   252     122    -130
fcntl_setlk64                                793     649    -144
fcntl_setlk                                  793     649    -144
__posix_lock_file                           1477    1026    -451

Signed-off-by: Matt Mackall &lt;mpm@selenic.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
<entry>
<title>NLM: Further cancel fixes</title>
<updated>2006-01-06T19:58:54+00:00</updated>
<author>
<name>J. Bruce Fields</name>
<email>bfields@fieldses.org</email>
</author>
<published>2006-01-03T08:55:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=64a318ee2af9000df482d7a125c3b3e1f1007404'/>
<id>urn:sha1:64a318ee2af9000df482d7a125c3b3e1f1007404</id>
<content type='text'>
 If the server receives an NLM cancel call and finds no waiting lock to
 cancel, then chances are the lock has already been applied, and the client
 just hadn't yet processed the NLM granted callback before it sent the
 cancel.

 The Open Group text, for example, perimts a server to return either success
 (LCK_GRANTED) or failure (LCK_DENIED) in this case.  But returning an error
 seems more helpful; the client may be able to use it to recognize that a
 race has occurred and to recover from the race.

 So, modify the relevant functions to return an error in this case.

 Signed-off-by: J. Bruce Fields &lt;bfields@citi.umich.edu&gt;
 Signed-off-by: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
</content>
</entry>
<entry>
<title>NLM: don't unlock on cancel requests</title>
<updated>2006-01-06T19:58:53+00:00</updated>
<author>
<name>J. Bruce Fields</name>
<email>bfields@fieldses.org</email>
</author>
<published>2006-01-03T08:55:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=5996a298da43a03081e9ba2116983d173001c862'/>
<id>urn:sha1:5996a298da43a03081e9ba2116983d173001c862</id>
<content type='text'>
 Currently when lockd gets an NLM_CANCEL request, it also does an unlock for
 the same range.  This is incorrect.

 The Open Group documentation says that "This procedure cancels an
 *outstanding* blocked lock request."  (Emphasis mine.)

 Also, consider a client that holds a lock on the first byte of a file, and
 requests a lock on the entire file.  If the client cancels that request
 (perhaps because the requesting process is signalled), the server shouldn't
 apply perform an unlock on the entire file, since that will also remove the
 previous lock that the client was already granted.

 Or consider a lock request that actually *downgraded* an exclusive lock to
 a shared lock.

 Signed-off-by: J. Bruce Fields &lt;bfields@citi.umich.edu&gt;
 Signed-off-by: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
</content>
</entry>
<entry>
<title>[PATCH] VFS: local denial-of-service with file leases</title>
<updated>2005-11-13T17:29:58+00:00</updated>
<author>
<name>Chris Wright</name>
<email>chrisw@osdl.org</email>
</author>
<published>2005-11-12T01:20:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=f3a9388e4ebea57583272007311fffa26ebbb305'/>
<id>urn:sha1:f3a9388e4ebea57583272007311fffa26ebbb305</id>
<content type='text'>
 Remove time_out_leases() printk that's easily triggered by users.

 Signed-off-by: Chris Wright &lt;chrisw@osdl.org&gt;
 Signed-off-by: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
</content>
</entry>
<entry>
<title>[PATCH] VFS: Fix memory leak with file leases</title>
<updated>2005-11-13T17:29:54+00:00</updated>
<author>
<name>J. Bruce Fields</name>
<email>bfields@fieldses.org</email>
</author>
<published>2005-11-11T00:08:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=dc15ae14e97ee9d5ed740cbb0b94996076d8b37e'/>
<id>urn:sha1:dc15ae14e97ee9d5ed740cbb0b94996076d8b37e</id>
<content type='text'>
 The patch
 http://linux.bkbits.net:8080/linux-2.6/diffs/fs/locks.c@1.70??nav=index.html
 introduced a pretty nasty memory leak in the lease code. When freeing
 the lease, the code in locks_delete_lock() will correctly clean up
 the fasync queue, but when we return to fcntl_setlease(), the freed
 fasync entry will be reinstated.

 This patch ensures that we skip the call to fasync_helper() when we're
 freeing up the lease.

 Signed-off-by: J. Bruce Fields &lt;bfields@fieldses.org&gt;
 Signed-off-by: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
</content>
</entry>
</feed>
