diff options
author | J. Bruce Fields <bfields@redhat.com> | 2010-10-30 17:31:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-30 18:08:15 -0700 |
commit | 096657b65e1ac197e20be5ce7cff6b6ca2532787 (patch) | |
tree | 61265f8d8075aee437597ffe050f339b207356e7 /fs | |
parent | 0ceaf6c700f8245946a163e387add8675a0c302f (diff) | |
download | kernel_samsung_tuna-096657b65e1ac197e20be5ce7cff6b6ca2532787.zip kernel_samsung_tuna-096657b65e1ac197e20be5ce7cff6b6ca2532787.tar.gz kernel_samsung_tuna-096657b65e1ac197e20be5ce7cff6b6ca2532787.tar.bz2 |
locks: fix leaks on setlease errors
We're depending on setlease to free the passed-in lease on failure.
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/locks.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -1371,20 +1371,22 @@ int generic_setlease(struct file *filp, long arg, struct file_lock **flp) struct inode *inode = dentry->d_inode; int error, rdlease_count = 0, wrlease_count = 0; + lease = *flp; + + error = -EACCES; if ((current_fsuid() != inode->i_uid) && !capable(CAP_LEASE)) - return -EACCES; + goto out; + error = -EINVAL; if (!S_ISREG(inode->i_mode)) - return -EINVAL; + goto out; error = security_file_lock(filp, arg); if (error) - return error; + goto out; time_out_leases(inode); BUG_ON(!(*flp)->fl_lmops->fl_break); - lease = *flp; - if (arg != F_UNLCK) { error = -EAGAIN; if ((arg == F_RDLCK) && (atomic_read(&inode->i_writecount) > 0)) |