From: ASANO Masahiro Date: Thu, 22 Dec 2005 04:24:54 +0000 (+0900) Subject: [PATCH] fix posix lock on NFS X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0800c5f7a499a8961c3868e95cc4cf1715166457;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git [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 Signed-off-by: Linus Torvalds --- 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))