From: Jeff Layton Date: Wed, 19 Nov 2014 12:51:13 +0000 (-0500) Subject: sunrpc: release svc_pool_map reference when serv allocation fails X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=067f96ef17455800bfbf87b743960e301e0b8e40;p=openwrt%2Fstaging%2Fblogic.git sunrpc: release svc_pool_map reference when serv allocation fails Currently, it leaks when the allocation fails. Signed-off-by: Jeff Layton Signed-off-by: J. Bruce Fields --- 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);