summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/locks.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/fs/locks.c b/fs/locks.c
index 3b54b98236ee..09d6c8c33c81 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1931,6 +1931,10 @@ int fcntl_getlk(struct file *filp, unsigned int cmd, struct flock __user *l)
goto out;
if (cmd == F_GETLKP) {
+ error = -EINVAL;
+ if (flock.l_pid != 0)
+ goto out;
+
cmd = F_GETLK;
file_lock.fl_flags |= FL_FILE_PVT;
file_lock.fl_owner = (fl_owner_t)filp;
@@ -2062,11 +2066,19 @@ again:
*/
switch (cmd) {
case F_SETLKP:
+ error = -EINVAL;
+ if (flock.l_pid != 0)
+ goto out;
+
cmd = F_SETLK;
file_lock->fl_flags |= FL_FILE_PVT;
file_lock->fl_owner = (fl_owner_t)filp;
break;
case F_SETLKPW:
+ error = -EINVAL;
+ if (flock.l_pid != 0)
+ goto out;
+
cmd = F_SETLKW;
file_lock->fl_flags |= FL_FILE_PVT;
file_lock->fl_owner = (fl_owner_t)filp;
@@ -2121,6 +2133,10 @@ int fcntl_getlk64(struct file *filp, unsigned int cmd, struct flock64 __user *l)
goto out;
if (cmd == F_GETLKP) {
+ error = -EINVAL;
+ if (flock.l_pid != 0)
+ goto out;
+
cmd = F_GETLK64;
file_lock.fl_flags |= FL_FILE_PVT;
file_lock.fl_owner = (fl_owner_t)filp;
@@ -2185,11 +2201,19 @@ again:
*/
switch (cmd) {
case F_SETLKP:
+ error = -EINVAL;
+ if (flock.l_pid != 0)
+ goto out;
+
cmd = F_SETLK64;
file_lock->fl_flags |= FL_FILE_PVT;
file_lock->fl_owner = (fl_owner_t)filp;
break;
case F_SETLKPW:
+ error = -EINVAL;
+ if (flock.l_pid != 0)
+ goto out;
+
cmd = F_SETLKW64;
file_lock->fl_flags |= FL_FILE_PVT;
file_lock->fl_owner = (fl_owner_t)filp;