From 37fb019cb02656d0ce0b8d40d56fe8c42f0d1658 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Tue, 28 Feb 2017 15:22:13 +0100 Subject: sunrpc: Do not unregister services if not registered [BZ #5010] The change in commit 718946816cf60374f9d8f674d3ed649fdb33205a has no effect because of two bugs which cancel each other out: The svc_is_mapped condition is inverted, and svc_is_mapped always returns false because the check is performed after the service has already been unregistered. As a result, pmap_unset is called unconditionally, as before. --- sunrpc/svc.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'sunrpc/svc.c') diff --git a/sunrpc/svc.c b/sunrpc/svc.c index 0aef2b5f95..03f963018c 100644 --- a/sunrpc/svc.c +++ b/sunrpc/svc.c @@ -182,17 +182,6 @@ done: return s; } - -static bool_t -svc_is_mapped (rpcprog_t prog, rpcvers_t vers) -{ - struct svc_callout *prev; - register struct svc_callout *s; - s = svc_find (prog, vers, &prev); - return s!= NULL_SVC && s->sc_mapped; -} - - /* Add a service program to the callout list. The dispatch routine will be called when a rpc request for this program number comes in. */ @@ -248,6 +237,7 @@ svc_unregister (rpcprog_t prog, rpcvers_t vers) if ((s = svc_find (prog, vers, &prev)) == NULL_SVC) return; + bool is_mapped = s->sc_mapped; if (prev == NULL_SVC) svc_head = s->sc_next; @@ -257,7 +247,7 @@ svc_unregister (rpcprog_t prog, rpcvers_t vers) s->sc_next = NULL_SVC; mem_free ((char *) s, (u_int) sizeof (struct svc_callout)); /* now unregister the information with the local binder service */ - if (! svc_is_mapped (prog, vers)) + if (is_mapped) pmap_unset (prog, vers); } libc_hidden_nolink_sunrpc (svc_unregister, GLIBC_2_0) -- cgit 1.4.1