Commit 1c74a244fcb61e6e1983d5725b8ccd5d3f51889c
Committed by
Trond Myklebust
1 parent
4edaa30888
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
SUNRPC: Don't recognize RPC_AUTH_MAXFLAVOR
RPC_AUTH_MAXFLAVOR is an invalid flavor, on purpose. Don't allow any processing whatsoever if a caller passes it to rpcauth_create() or rpcauth_get_gssinfo(). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Showing 1 changed file with 4 additions and 1 deletions Side-by-side Diff
net/sunrpc/auth.c
... | ... | @@ -82,7 +82,7 @@ |
82 | 82 | |
83 | 83 | static u32 |
84 | 84 | pseudoflavor_to_flavor(u32 flavor) { |
85 | - if (flavor >= RPC_AUTH_MAXFLAVOR) | |
85 | + if (flavor > RPC_AUTH_MAXFLAVOR) | |
86 | 86 | return RPC_AUTH_GSS; |
87 | 87 | return flavor; |
88 | 88 | } |
... | ... | @@ -172,6 +172,9 @@ |
172 | 172 | rpc_authflavor_t flavor = pseudoflavor_to_flavor(pseudoflavor); |
173 | 173 | const struct rpc_authops *ops; |
174 | 174 | int result; |
175 | + | |
176 | + if (flavor >= RPC_AUTH_MAXFLAVOR) | |
177 | + return -EINVAL; | |
175 | 178 | |
176 | 179 | ops = auth_flavors[flavor]; |
177 | 180 | if (ops == NULL) |