From dc7d719fc1280a56255d5a2a2a44b0d094722b132e0bd23d35d5b41f9198c917 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Mon, 30 Apr 2018 12:13:18 +0000 Subject: [PATCH] Accepting request 597811 from home:tsaupe:branches:Base:System fix socket leak introduced by change rpc protocol version patch (bsc#1087925) OBS-URL: https://build.opensuse.org/request/show/597811 OBS-URL: https://build.opensuse.org/package/show/Base:System/libtirpc?expand=0&rev=73 --- ...ntroduced-by-change-rpc-version-orde.patch | 73 +++++++++++++++++++ libtirpc.changes | 6 ++ libtirpc.spec | 2 + 3 files changed, 81 insertions(+) create mode 100644 0001-Fix-regression-introduced-by-change-rpc-version-orde.patch diff --git a/0001-Fix-regression-introduced-by-change-rpc-version-orde.patch b/0001-Fix-regression-introduced-by-change-rpc-version-orde.patch new file mode 100644 index 0000000..7b2795b --- /dev/null +++ b/0001-Fix-regression-introduced-by-change-rpc-version-orde.patch @@ -0,0 +1,73 @@ +From 25d38d744997d5ff03d8b0f2cdd79c0fb7185cca Mon Sep 17 00:00:00 2001 +From: Thomas Blume +Date: Wed, 18 Apr 2018 08:44:49 -0400 +Subject: [PATCH] Fix regression introduced by change rpc version order patch + +Fix a socket leak introduced by commit 5e7b57bc20bd9cadff +(rpcinfo: change order of version to be tried to 4, 3, 2) +The new function __try_protocol_version_2 doesn't return +the client, so it can't be closed via CLNT_DESTROY in the +calling function. + +Signed-off-by: Thomas Blume +Signed-off-by: Steve Dickson +--- + src/rpcb_clnt.c | 18 ++++++++++++++---- + 1 file changed, 14 insertions(+), 4 deletions(-) + +diff --git a/src/rpcb_clnt.c b/src/rpcb_clnt.c +index a94fc73..4b44364 100644 +--- a/src/rpcb_clnt.c ++++ b/src/rpcb_clnt.c +@@ -752,7 +752,7 @@ __try_protocol_version_2(program, version, nconf, host, tp) + + client = getpmaphandle(nconf, host, &parms.r_addr); + if (client == NULL) +- return (NULL); ++ goto error; + + /* + * Set retry timeout. +@@ -771,11 +771,11 @@ __try_protocol_version_2(program, version, nconf, host, tp) + if (clnt_st != RPC_SUCCESS) { + rpc_createerr.cf_stat = RPC_PMAPFAILURE; + clnt_geterr(client, &rpc_createerr.cf_error); +- return (NULL); ++ goto error; + } else if (port == 0) { + pmapaddress = NULL; + rpc_createerr.cf_stat = RPC_PROGNOTREGISTERED; +- return (NULL); ++ goto error; + } + port = htons(port); + CLNT_CONTROL(client, CLGET_SVC_ADDR, (char *)&remote); +@@ -789,14 +789,24 @@ __try_protocol_version_2(program, version, nconf, host, tp) + free(pmapaddress); + pmapaddress = NULL; + } +- return (NULL); ++ goto error; + } + memcpy(pmapaddress->buf, remote.buf, remote.len); + memcpy(&((char *)pmapaddress->buf)[sizeof (short)], + (char *)(void *)&port, sizeof (short)); + pmapaddress->len = pmapaddress->maxlen = remote.len; + ++ CLNT_DESTROY(client); + return pmapaddress; ++ ++error: ++ if (client) { ++ CLNT_DESTROY(client); ++ client = NULL; ++ ++ } ++ return (NULL); ++ + } + #endif + +-- +2.13.6 + diff --git a/libtirpc.changes b/libtirpc.changes index 0d7122f..2182d67 100644 --- a/libtirpc.changes +++ b/libtirpc.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Apr 12 08:06:23 UTC 2018 - Thomas.Blume@suse.com + +- fix socket leak introduced by change-rpc-protocol-version-order patch + (bsc#1087925) + ------------------------------------------------------------------- Thu Apr 5 13:26:43 CEST 2018 - kukuk@suse.de diff --git a/libtirpc.spec b/libtirpc.spec index 901bc81..cd29f17 100644 --- a/libtirpc.spec +++ b/libtirpc.spec @@ -39,6 +39,7 @@ Patch0: 000-bindresvport_blacklist.patch Patch1: 001-new-rpcbindsock-path.patch # Revert upstream change until tirpc 1.0.4 with a final solutions comes out Patch2: 002-revert-binddynport.patch +Patch3: 0001-Fix-regression-introduced-by-change-rpc-version-orde.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %define debug_package_requires libtirpc3 = %{version}-%{release} @@ -88,6 +89,7 @@ TCP over IPv4. %patch1 -p1 %endif %patch2 -p1 +%patch3 -p1 %build sed -i -e 's|@includedir@/tirpc|@includedir@|g' libtirpc.pc.in