diff options
author | J. Bruce Fields <bfields@redhat.com> | 2014-02-03 12:13:08 -0500 |
---|---|---|
committer | Jeff Layton <jlayton@redhat.com> | 2014-03-31 08:24:42 -0400 |
commit | ef12e72a01f3022c55e5a8e0fa1caebdc7efcfce (patch) | |
tree | 54209e0731082ff7e2a36ede9b045d415132134e /include/uapi/scsi | |
parent | 8c3cac5e6a85f03602ffe09c44f14418699e31ec (diff) |
locks: fix posix lock range overflow handling
In the 32-bit case fcntl assigns the 64-bit f_pos and i_size to a 32-bit
off_t.
The existing range checks also seem to depend on signed arithmetic
wrapping when it overflows. In practice maybe that works, but we can be
more careful. That also allows us to make a more reliable distinction
between -EINVAL and -EOVERFLOW.
Note that in the 32-bit case SEEK_CUR or SEEK_END might allow the caller
to set a lock with starting point no longer representable as a 32-bit
value. We could return -EOVERFLOW in such cases, but the locks code is
capable of handling such ranges, so we choose to be lenient here. The
only problem is that subsequent GETLK calls on such a lock will fail
with EOVERFLOW.
While we're here, do some cleanup including consolidating code for the
flock and flock64 cases.
Signed-off-by: J. Bruce Fields <bfields@fieldses.org>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Diffstat (limited to 'include/uapi/scsi')
0 files changed, 0 insertions, 0 deletions