diff options
Diffstat (limited to 'fs/locks.c')
-rw-r--r-- | fs/locks.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/locks.c b/fs/locks.c index 0d68f1f81799..814c51d0de47 100644 --- a/fs/locks.c +++ b/fs/locks.c | |||
@@ -1446,7 +1446,7 @@ int generic_setlease(struct file *filp, long arg, struct file_lock **flp) | |||
1446 | struct inode *inode = dentry->d_inode; | 1446 | struct inode *inode = dentry->d_inode; |
1447 | int error; | 1447 | int error; |
1448 | 1448 | ||
1449 | if ((current_fsuid() != inode->i_uid) && !capable(CAP_LEASE)) | 1449 | if ((!uid_eq(current_fsuid(), inode->i_uid)) && !capable(CAP_LEASE)) |
1450 | return -EACCES; | 1450 | return -EACCES; |
1451 | if (!S_ISREG(inode->i_mode)) | 1451 | if (!S_ISREG(inode->i_mode)) |
1452 | return -EINVAL; | 1452 | return -EINVAL; |
@@ -1636,12 +1636,13 @@ EXPORT_SYMBOL(flock_lock_file_wait); | |||
1636 | SYSCALL_DEFINE2(flock, unsigned int, fd, unsigned int, cmd) | 1636 | SYSCALL_DEFINE2(flock, unsigned int, fd, unsigned int, cmd) |
1637 | { | 1637 | { |
1638 | struct file *filp; | 1638 | struct file *filp; |
1639 | int fput_needed; | ||
1639 | struct file_lock *lock; | 1640 | struct file_lock *lock; |
1640 | int can_sleep, unlock; | 1641 | int can_sleep, unlock; |
1641 | int error; | 1642 | int error; |
1642 | 1643 | ||
1643 | error = -EBADF; | 1644 | error = -EBADF; |
1644 | filp = fget(fd); | 1645 | filp = fget_light(fd, &fput_needed); |
1645 | if (!filp) | 1646 | if (!filp) |
1646 | goto out; | 1647 | goto out; |
1647 | 1648 | ||
@@ -1674,7 +1675,7 @@ SYSCALL_DEFINE2(flock, unsigned int, fd, unsigned int, cmd) | |||
1674 | locks_free_lock(lock); | 1675 | locks_free_lock(lock); |
1675 | 1676 | ||
1676 | out_putf: | 1677 | out_putf: |
1677 | fput(filp); | 1678 | fput_light(filp, fput_needed); |
1678 | out: | 1679 | out: |
1679 | return error; | 1680 | return error; |
1680 | } | 1681 | } |