diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-04-16 16:41:10 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-05-14 15:09:29 -0400 |
commit | 19445b99b6d66af661c586c052de23110731a502 (patch) | |
tree | b5a77b701b466598af631ef5a7db705f6e7c59ad /net/sunrpc/sched.c | |
parent | ee5ebe851ed60206f150d3f189416f9c63245b66 (diff) | |
download | linux-3.10-19445b99b6d66af661c586c052de23110731a502.tar.gz linux-3.10-19445b99b6d66af661c586c052de23110731a502.tar.bz2 linux-3.10-19445b99b6d66af661c586c052de23110731a502.zip |
SUNRPC: Cleanup - make rpc_new_task() call rpc_release_calldata on failure
Also have it return an ERR_PTR(-ENOMEM) instead of a null pointer.
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/sched.c')
-rw-r--r-- | net/sunrpc/sched.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index aae6907fd54..c8979ce5d88 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c @@ -856,16 +856,23 @@ struct rpc_task *rpc_new_task(const struct rpc_task_setup *setup_data) if (task == NULL) { task = rpc_alloc_task(); - if (task == NULL) - goto out; + if (task == NULL) { + rpc_release_calldata(setup_data->callback_ops, + setup_data->callback_data); + return ERR_PTR(-ENOMEM); + } flags = RPC_TASK_DYNAMIC; } rpc_init_task(task, setup_data); + if (task->tk_status < 0) { + int err = task->tk_status; + rpc_put_task(task); + return ERR_PTR(err); + } task->tk_flags |= flags; dprintk("RPC: allocated task %p\n", task); -out: return task; } |