<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/fs/locks.c, branch v3.4.19</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/fs/locks.c?h=v3.4.19</id>
<link rel='self' href='https://git.amat.us/linux/atom/fs/locks.c?h=v3.4.19'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2012-08-09T15:31:29Z</updated>
<entry>
<title>locks: fix checking of fcntl_setlease argument</title>
<updated>2012-08-09T15:31:29Z</updated>
<author>
<name>J. Bruce Fields</name>
<email>bfields@fieldses.org</email>
</author>
<published>2012-07-23T19:17:17Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=fd3cca0a4e6ac0512e9122f59dfe0214b74049fb'/>
<id>urn:sha1:fd3cca0a4e6ac0512e9122f59dfe0214b74049fb</id>
<content type='text'>
commit 0ec4f431eb56d633da3a55da67d5c4b88886ccc7 upstream.

The only checks of the long argument passed to fcntl(fd,F_SETLEASE,.)
are done after converting the long to an int.  Thus some illegal values
may be let through and cause problems in later code.

[ They actually *don't* cause problems in mainline, as of Dave Jones's
  commit 8d657eb3b438 "Remove easily user-triggerable BUG from
  generic_setlease", but we should fix this anyway.  And this patch will
  be necessary to fix real bugs on earlier kernels. ]

Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>Remove easily user-triggerable BUG from generic_setlease</title>
<updated>2012-07-19T15:58:54Z</updated>
<author>
<name>Dave Jones</name>
<email>davej@redhat.com</email>
</author>
<published>2012-07-13T17:35:36Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=dfd45e89bc8040c45ad5df89fb01d7d0138ec953'/>
<id>urn:sha1:dfd45e89bc8040c45ad5df89fb01d7d0138ec953</id>
<content type='text'>
commit 8d657eb3b43861064d36241e88d9d61c709f33f0 upstream.

This can be trivially triggered from userspace by passing in something unexpected.

    kernel BUG at fs/locks.c:1468!
    invalid opcode: 0000 [#1] SMP
    RIP: 0010:generic_setlease+0xc2/0x100
    Call Trace:
      __vfs_setlease+0x35/0x40
      fcntl_setlease+0x76/0x150
      sys_fcntl+0x1c6/0x810
      system_call_fastpath+0x1a/0x1f

Signed-off-by: Dave Jones &lt;davej@redhat.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>CIFS: Fix VFS lock usage for oplocked files</title>
<updated>2012-04-01T18:54:27Z</updated>
<author>
<name>Pavel Shilovsky</name>
<email>piastry@etersoft.ru</email>
</author>
<published>2012-03-28T17:56:19Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=66189be74ff5f9f3fd6444315b85be210d07cef2'/>
<id>urn:sha1:66189be74ff5f9f3fd6444315b85be210d07cef2</id>
<content type='text'>
We can deadlock if we have a write oplock and two processes
use the same file handle. In this case the first process can't
unlock its lock if the second process blocked on the lock in the
same time.

Fix it by using posix_lock_file rather than posix_lock_file_wait
under cinode-&gt;lock_mutex. If we request a blocking lock and
posix_lock_file indicates that there is another lock that prevents
us, wait untill that lock is released and restart our call.

Cc: stable@kernel.org
Acked-by: Jeff Layton &lt;jlayton@redhat.com&gt;
Signed-off-by: Pavel Shilovsky &lt;piastry@etersoft.ru&gt;
Signed-off-by: Steve French &lt;sfrench@us.ibm.com&gt;
</content>
</entry>
<entry>
<title>vfs: fix handling of lock allocation failure in lease-break case</title>
<updated>2011-12-26T18:25:26Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2011-12-26T18:25:26Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=6d4b9e38d3980826abccfbd90e95bf4bd41b8dd2'/>
<id>urn:sha1:6d4b9e38d3980826abccfbd90e95bf4bd41b8dd2</id>
<content type='text'>
Bruce Fields notes that commit 778fc546f749 ("locks: fix tracking of
inprogress lease breaks") introduced a possible error pointer
dereference on failure to allocate memory.  locks_conflict() will
dereference the passed-in new lease lock structure that may be an error pointer.

This means an open (without O_NONBLOCK set) on a file with a lease
applied (generally only done when Samba or nfsd (with v4) is running)
could crash if a kmalloc() fails.

So instead of playing games with IS_ERROR() all over the place, just
check the allocation failure early.  That makes the code more
straightforward, and avoids this possible bad pointer dereference.

Based-on-patch-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
Cc: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>Merge branch 'for-3.2' of git://linux-nfs.org/~bfields/linux</title>
<updated>2011-10-25T13:42:01Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2011-10-25T13:42:01Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=1442d1678ca7e53574fd403ba7bee6f4125d920c'/>
<id>urn:sha1:1442d1678ca7e53574fd403ba7bee6f4125d920c</id>
<content type='text'>
* 'for-3.2' of git://linux-nfs.org/~bfields/linux: (103 commits)
  nfs41: implement DESTROY_CLIENTID operation
  nfsd4: typo logical vs bitwise negate for want_mask
  nfsd4: allow NFS4_SHARE_SIGNAL_DELEG_WHEN_RESRC_AVAIL | NFS4_SHARE_PUSH_DELEG_WHEN_UNCONTENDED
  nfsd4: seq-&gt;status_flags may be used unitialized
  nfsd41: use SEQ4_STATUS_BACKCHANNEL_FAULT when cb_sequence is invalid
  nfsd4: implement new 4.1 open reclaim types
  nfsd4: remove unneeded CLAIM_DELEGATE_CUR workaround
  nfsd4: warn on open failure after create
  nfsd4: preallocate open stateid in process_open1()
  nfsd4: do idr preallocation with stateid allocation
  nfsd4: preallocate nfs4_file in process_open1()
  nfsd4: clean up open owners on OPEN failure
  nfsd4: simplify process_open1 logic
  nfsd4: make is_open_owner boolean
  nfsd4: centralize renew_client() calls
  nfsd4: typo logical vs bitwise negate
  nfs: fix bug about IPv6 address scope checking
  nfsd4: more robust ignoring of WANT bits in OPEN
  nfsd4: move name-length checks to xdr
  nfsd4: move access/deny validity checks to xdr code
  ...
</content>
</entry>
<entry>
<title>doc: fix broken references</title>
<updated>2011-09-27T16:08:04Z</updated>
<author>
<name>Paul Bolle</name>
<email>pebolle@tiscali.nl</email>
</author>
<published>2011-08-15T00:02:26Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=395cf9691d72173d8cdaa613c5f0255f993af94b'/>
<id>urn:sha1:395cf9691d72173d8cdaa613c5f0255f993af94b</id>
<content type='text'>
There are numerous broken references to Documentation files (in other
Documentation files, in comments, etc.). These broken references are
caused by typo's in the references, and by renames or removals of the
Documentation files. Some broken references are simply odd.

Fix these broken references, sometimes by dropping the irrelevant text
they were part of.

Signed-off-by: Paul Bolle &lt;pebolle@tiscali.nl&gt;
Signed-off-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
</content>
</entry>
<entry>
<title>leases: split up generic_setlease into lock/unlock cases</title>
<updated>2011-09-21T14:40:54Z</updated>
<author>
<name>J. Bruce Fields</name>
<email>bfields@redhat.com</email>
</author>
<published>2011-09-21T12:34:32Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=8335ebd94b3f5bed7875cc35848bbe46d8381695'/>
<id>urn:sha1:8335ebd94b3f5bed7875cc35848bbe46d8381695</id>
<content type='text'>
Eventually we should probably do the same thing to the file operations
as well.

Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
</content>
</entry>
<entry>
<title>locks: setlease cleanup</title>
<updated>2011-08-19T17:25:35Z</updated>
<author>
<name>J. Bruce Fields</name>
<email>bfields@redhat.com</email>
</author>
<published>2011-08-19T14:59:49Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=c1f24ef4ed46f58ea5e524a2364c93b6847fb164'/>
<id>urn:sha1:c1f24ef4ed46f58ea5e524a2364c93b6847fb164</id>
<content type='text'>
There's an incorrect comment here.  Also clean up the logic: the
"rdlease" and "wrlease" locals are confusingly named, and don't really
add anything since we can make a decision as soon as we hit one of these
cases.

Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
</content>
</entry>
<entry>
<title>locks: fix tracking of inprogress lease breaks</title>
<updated>2011-08-19T17:25:34Z</updated>
<author>
<name>J. Bruce Fields</name>
<email>bfields@redhat.com</email>
</author>
<published>2011-07-26T22:25:49Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=778fc546f749c588aa2f6cd50215d2715c374252'/>
<id>urn:sha1:778fc546f749c588aa2f6cd50215d2715c374252</id>
<content type='text'>
We currently use a bit in fl_flags to record whether a lease is being
broken, and set fl_type to the type (RDLCK or UNLCK) that it will
eventually have.  This means that once the lease break starts, we forget
what the lease's type *used* to be.  Breaking a read lease will then
result in blocking read opens, even though there's no conflict--because
the lease type is now F_UNLCK and we can no longer tell whether it was
previously a read or write lease.

So, instead keep fl_type as the original type (the type which we
enforce), and keep track of whether we're unlocking or merely
downgrading by replacing the single FL_INPROGRESS flag by
FL_UNLOCK_PENDING and FL_DOWNGRADE_PENDING flags.

To get this right we also need to track separate downgrade and break
times, to handle the case where a write-leased file gets conflicting
opens first for read, then later for write.

(I first considered just eliminating the downgrade behavior
completely--nfsv4 doesn't need it, and nobody as far as I can tell
actually uses it currently--but Jeremy Allison tells me that Windows
oplocks do behave this way, so Samba will probably use this some day.)

Reviewed-by: Jeff Layton &lt;jlayton@redhat.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
</content>
</entry>
<entry>
<title>locks: move F_INPROGRESS from fl_type to fl_flags field</title>
<updated>2011-08-19T17:25:34Z</updated>
<author>
<name>J. Bruce Fields</name>
<email>bfields@redhat.com</email>
</author>
<published>2011-07-26T20:28:29Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=710b7216964d6455cf1b215c43b03a1a79008c7d'/>
<id>urn:sha1:710b7216964d6455cf1b215c43b03a1a79008c7d</id>
<content type='text'>
F_INPROGRESS isn't exposed to userspace.  To me it makes more sense in
fl_flags....

Reviewed-by: Jeff Layton &lt;jlayton@redhat.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
</content>
</entry>
</feed>
