aboutsummaryrefslogtreecommitdiffstats
path: root/fs/locks.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/locks.c')
-rw-r--r--fs/locks.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/fs/locks.c b/fs/locks.c
index 06c77734f589..63fbc41cc573 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1371,20 +1371,22 @@ int generic_setlease(struct file *filp, long arg, struct file_lock **flp)
1371 struct inode *inode = dentry->d_inode; 1371 struct inode *inode = dentry->d_inode;
1372 int error, rdlease_count = 0, wrlease_count = 0; 1372 int error, rdlease_count = 0, wrlease_count = 0;
1373 1373
1374 lease = *flp;
1375
1376 error = -EACCES;
1374 if ((current_fsuid() != inode->i_uid) && !capable(CAP_LEASE)) 1377 if ((current_fsuid() != inode->i_uid) && !capable(CAP_LEASE))
1375 return -EACCES; 1378 goto out;
1379 error = -EINVAL;
1376 if (!S_ISREG(inode->i_mode)) 1380 if (!S_ISREG(inode->i_mode))
1377 return -EINVAL; 1381 goto out;
1378 error = security_file_lock(filp, arg); 1382 error = security_file_lock(filp, arg);
1379 if (error) 1383 if (error)
1380 return error; 1384 goto out;
1381 1385
1382 time_out_leases(inode); 1386 time_out_leases(inode);
1383 1387
1384 BUG_ON(!(*flp)->fl_lmops->fl_break); 1388 BUG_ON(!(*flp)->fl_lmops->fl_break);
1385 1389
1386 lease = *flp;
1387
1388 if (arg != F_UNLCK) { 1390 if (arg != F_UNLCK) {
1389 error = -EAGAIN; 1391 error = -EAGAIN;
1390 if ((arg == F_RDLCK) && (atomic_read(&inode->i_writecount) > 0)) 1392 if ((arg == F_RDLCK) && (atomic_read(&inode->i_writecount) > 0))