From a59b194a7b40a08dc3d3ffe01f7781acd43ae60f Mon Sep 17 00:00:00 2001 From: Dan McDonald Date: Mon, 4 May 2020 19:58:45 -0400 Subject: OS-8167 lx_upcall_statd() may hang-or-panic when trying to upcall (#299) Reviewed by: Max Bruning Reviewed by: Jason King Approved by: Jason King --- usr/src/uts/common/brand/lx/os/lx_lockd.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'usr/src') diff --git a/usr/src/uts/common/brand/lx/os/lx_lockd.c b/usr/src/uts/common/brand/lx/os/lx_lockd.c index d6d965398a..37b744b0e8 100644 --- a/usr/src/uts/common/brand/lx/os/lx_lockd.c +++ b/usr/src/uts/common/brand/lx/os/lx_lockd.c @@ -297,6 +297,18 @@ lx_upcall_statd(int op, struct nlm_globals *g, struct nlm_host *host) * as we pass to monitor, so that is also handled here by this same * brand hook. */ + + /* + * If the NLM was set up to be "v4 only" (i.e. no RPC call handlers + * to localhost at configure time), the semaphore is uninitialized, + * and will indefinitely hang. FURTHERMORE if just the semaphore + * was initialized, we'd still panic with a NULL nsm->ns_handle. + */ + if (g->nlm_v4_only) { + stat = RPC_SYSTEMERROR; + goto bail; + } + nlm_netbuf_to_netobj(&host->nh_addr, &family, &obj); nsm = &g->nlm_nsm; @@ -327,6 +339,7 @@ lx_upcall_statd(int op, struct nlm_globals *g, struct nlm_host *host) } sema_v(&nsm->ns_sem); +bail: if (stat != RPC_SUCCESS) { NLM_WARN("Failed to contact local statd, stat=%d", stat); if (op == SM_MON) { -- cgit v1.2.3