mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-04-13 09:59:31 +00:00
SUNRPC: Fix unx_lookup_cred() allocation
Default to the same mempool allocation strategy as for rpc_malloc(). Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
This commit is contained in:
parent
910ad38697
commit
059ee82b64
1 changed files with 10 additions and 8 deletions
|
@ -40,17 +40,19 @@ unx_destroy(struct rpc_auth *auth)
|
||||||
/*
|
/*
|
||||||
* Lookup AUTH_UNIX creds for current process
|
* Lookup AUTH_UNIX creds for current process
|
||||||
*/
|
*/
|
||||||
static struct rpc_cred *
|
static struct rpc_cred *unx_lookup_cred(struct rpc_auth *auth,
|
||||||
unx_lookup_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
|
struct auth_cred *acred, int flags)
|
||||||
{
|
{
|
||||||
gfp_t gfp = GFP_KERNEL;
|
|
||||||
struct rpc_cred *ret;
|
struct rpc_cred *ret;
|
||||||
|
|
||||||
if (flags & RPCAUTH_LOOKUP_ASYNC)
|
ret = kmalloc(sizeof(*ret), rpc_task_gfp_mask());
|
||||||
gfp = GFP_NOWAIT | __GFP_NOWARN;
|
if (!ret) {
|
||||||
ret = mempool_alloc(unix_pool, gfp);
|
if (!(flags & RPCAUTH_LOOKUP_ASYNC))
|
||||||
if (!ret)
|
return ERR_PTR(-ENOMEM);
|
||||||
return ERR_PTR(-ENOMEM);
|
ret = mempool_alloc(unix_pool, GFP_NOWAIT);
|
||||||
|
if (!ret)
|
||||||
|
return ERR_PTR(-ENOMEM);
|
||||||
|
}
|
||||||
rpcauth_init_cred(ret, acred, auth, &unix_credops);
|
rpcauth_init_cred(ret, acred, auth, &unix_credops);
|
||||||
ret->cr_flags = 1UL << RPCAUTH_CRED_UPTODATE;
|
ret->cr_flags = 1UL << RPCAUTH_CRED_UPTODATE;
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Add table
Reference in a new issue