[Devel] [PATCH] SUNRPC: destroy freshly allocated transport in case of sockaddr init error
Stanislav Kinsbursky
skinsbursky at parallels.com
Thu Nov 10 03:33:23 PST 2011
Otherwise we will leak xprt structure and struct net reference.
Signed-off-by: Stanislav Kinsbursky <skinsbursky at parallels.com>
---
net/sunrpc/xprtsock.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index d7f97ef..2d78d95 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -2530,8 +2530,10 @@ static struct rpc_xprt *xs_setup_xprt(struct xprt_create *args,
int err;
err = xs_init_anyaddr(args->dstaddr->sa_family,
(struct sockaddr *)&new->srcaddr);
- if (err != 0)
+ if (err != 0) {
+ xprt_free(xprt);
return ERR_PTR(err);
+ }
}
return xprt;
More information about the Devel
mailing list