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>
This commit is contained in:
		
					parent
					
						
							
								4edaa30888
							
						
					
				
			
			
				commit
				
					
						1c74a244fc
					
				
			
		
					 1 changed files with 4 additions and 1 deletions
				
			
		| 
						 | 
					@ -82,7 +82,7 @@ MODULE_PARM_DESC(auth_hashtable_size, "RPC credential cache hashtable size");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static u32
 | 
					static u32
 | 
				
			||||||
pseudoflavor_to_flavor(u32 flavor) {
 | 
					pseudoflavor_to_flavor(u32 flavor) {
 | 
				
			||||||
	if (flavor >= RPC_AUTH_MAXFLAVOR)
 | 
						if (flavor > RPC_AUTH_MAXFLAVOR)
 | 
				
			||||||
		return RPC_AUTH_GSS;
 | 
							return RPC_AUTH_GSS;
 | 
				
			||||||
	return flavor;
 | 
						return flavor;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -173,6 +173,9 @@ rpcauth_get_gssinfo(rpc_authflavor_t pseudoflavor, struct rpcsec_gss_info *info)
 | 
				
			||||||
	const struct rpc_authops *ops;
 | 
						const struct rpc_authops *ops;
 | 
				
			||||||
	int result;
 | 
						int result;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (flavor >= RPC_AUTH_MAXFLAVOR)
 | 
				
			||||||
 | 
							return -EINVAL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ops = auth_flavors[flavor];
 | 
						ops = auth_flavors[flavor];
 | 
				
			||||||
	if (ops == NULL)
 | 
						if (ops == NULL)
 | 
				
			||||||
		request_module("rpc-auth-%u", flavor);
 | 
							request_module("rpc-auth-%u", flavor);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue