Skip to content

Commit 8445cd3

Browse files
androsadamsontrondmypd
authored andcommitted
NFS Return -EPERM if no supported or matching SECINFO flavor
Do not return RPC_AUTH_UNIX if SEINFO reply tests fail. This prevents an infinite loop of NFS4ERR_WRONGSEC for non RPC_AUTH_UNIX mounts. Without this patch, a mount with no sec= option to a server that does not include RPC_AUTH_UNIX in the SECINFO return can be presented with an attemtp to use RPC_AUTH_UNIX which will result in an NFS4ERR_WRONG_SEC which will prompt the SECINFO call which will again try RPC_AUTH_UNIX.... Signed-off-by: Andy Adamson <[email protected]> Tested-By: Steve Dickson <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
1 parent 57bbe3d commit 8445cd3

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

fs/nfs/nfs4namespace.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,11 @@ static size_t nfs_parse_server_name(char *string, size_t len,
140140
* @flavors: List of security tuples returned by SECINFO procedure
141141
*
142142
* Return the pseudoflavor of the first security mechanism in
143-
* "flavors" that is locally supported. Return RPC_AUTH_UNIX if
144-
* no matching flavor is found in the array. The "flavors" array
143+
* "flavors" that is locally supported. The "flavors" array
145144
* is searched in the order returned from the server, per RFC 3530
146145
* recommendation.
146+
*
147+
* Return -EPERM if no matching flavor is found in the array.
147148
*/
148149
static rpc_authflavor_t nfs_find_best_sec(struct nfs_server *server,
149150
struct nfs4_secinfo_flavors *flavors)
@@ -170,11 +171,7 @@ static rpc_authflavor_t nfs_find_best_sec(struct nfs_server *server,
170171
}
171172
}
172173

173-
/* if there were any sec= options then nothing matched */
174-
if (server->auth_info.flavor_len > 0)
175-
return -EPERM;
176-
177-
return RPC_AUTH_UNIX;
174+
return -EPERM;
178175
}
179176

180177
static rpc_authflavor_t nfs4_negotiate_security(struct inode *inode, struct qstr *name)

0 commit comments

Comments
 (0)