diff options
author | ASANO Masahiro <masano@tnes.nec.co.jp> | 2005-12-22 05:24:54 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-12-22 18:24:05 +0100 |
commit | 0800c5f7a499a8961c3868e95cc4cf1715166457 (patch) | |
tree | 609cb9c9cb8e3219722df13907527d3410ae861b /fs/nfs | |
parent | [PATCH] fix race with preempt_enable() (diff) | |
download | linux-0800c5f7a499a8961c3868e95cc4cf1715166457.tar.xz linux-0800c5f7a499a8961c3868e95cc4cf1715166457.zip |
[PATCH] fix posix lock on NFS
NFS client prevents mandatory lock, but there is a flaw on it; Locks are
possibly left if the mode is changed while locking.
This permits unlocking even if the mandatory lock bits are set.
Signed-off-by: ASANO Masahiro <masano@tnes.nec.co.jp>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/file.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index eb5cd4c3bbfd..7a79fbe9f539 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c @@ -509,7 +509,8 @@ static int nfs_lock(struct file *filp, int cmd, struct file_lock *fl) return -EINVAL; /* No mandatory locks over NFS */ - if ((inode->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID) + if ((inode->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID && + fl->fl_type != F_UNLCK) return -ENOLCK; if (IS_GETLK(cmd)) |