summaryrefslogtreecommitdiff
path: root/net/sunrpc/svc.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@primarydata.com>2014-11-19 15:51:13 +0300
committerJ. Bruce Fields <bfields@redhat.com>2014-12-01 22:45:27 +0300
commit067f96ef17455800bfbf87b743960e301e0b8e40 (patch)
tree2d1d2f92da1b94943a36917163bb78db23333387 /net/sunrpc/svc.c
parent8d65ef760d50cc625c5364cba89be838b21c66a7 (diff)
downloadlinux-067f96ef17455800bfbf87b743960e301e0b8e40.tar.xz
sunrpc: release svc_pool_map reference when serv allocation fails
Currently, it leaks when the allocation fails. Signed-off-by: Jeff Layton <jlayton@primarydata.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'net/sunrpc/svc.c')
-rw-r--r--net/sunrpc/svc.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index 349c98f9818b..537add5309cc 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -503,13 +503,15 @@ svc_create_pooled(struct svc_program *prog, unsigned int bufsize,
unsigned int npools = svc_pool_map_get();
serv = __svc_create(prog, bufsize, npools, shutdown);
+ if (!serv)
+ goto out_err;
- if (serv != NULL) {
- serv->sv_function = func;
- serv->sv_module = mod;
- }
-
+ serv->sv_function = func;
+ serv->sv_module = mod;
return serv;
+out_err:
+ svc_pool_map_put();
+ return NULL;
}
EXPORT_SYMBOL_GPL(svc_create_pooled);