]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.11.9/nfsv4.2-don-t-send-mode-again-in-post-exclusive4_1-setattr-with-umask.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.11.9 / nfsv4.2-don-t-send-mode-again-in-post-exclusive4_1-setattr-with-umask.patch
1 From 501e7a4689378f8b1690089bfdd4f1e12ec22903 Mon Sep 17 00:00:00 2001
2 From: Benjamin Coddington <bcodding@redhat.com>
3 Date: Fri, 2 Jun 2017 11:21:34 -0400
4 Subject: NFSv4.2: Don't send mode again in post-EXCLUSIVE4_1 SETATTR with umask
5
6 From: Benjamin Coddington <bcodding@redhat.com>
7
8 commit 501e7a4689378f8b1690089bfdd4f1e12ec22903 upstream.
9
10 Now that we have umask support, we shouldn't re-send the mode in a SETATTR
11 following an exclusive CREATE, or we risk having the same problem fixed in
12 commit 5334c5bdac92 ("NFS: Send attributes in OPEN request for
13 NFS4_CREATE_EXCLUSIVE4_1"), which is that files with S_ISGID will have that
14 bit stripped away.
15
16 Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
17 Fixes: dff25ddb4808 ("nfs: add support for the umask attribute")
18 Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
19 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20
21 ---
22 fs/nfs/nfs4proc.c | 3 ++-
23 1 file changed, 2 insertions(+), 1 deletion(-)
24
25 --- a/fs/nfs/nfs4proc.c
26 +++ b/fs/nfs/nfs4proc.c
27 @@ -2588,7 +2588,8 @@ static inline void nfs4_exclusive_attrse
28
29 /* Except MODE, it seems harmless of setting twice. */
30 if (opendata->o_arg.createmode != NFS4_CREATE_EXCLUSIVE &&
31 - attrset[1] & FATTR4_WORD1_MODE)
32 + (attrset[1] & FATTR4_WORD1_MODE ||
33 + attrset[2] & FATTR4_WORD2_MODE_UMASK))
34 sattr->ia_valid &= ~ATTR_MODE;
35
36 if (attrset[2] & FATTR4_WORD2_SECURITY_LABEL)