diff options
author | Dan McDonald <danmcd@joyent.com> | 2020-05-04 19:58:45 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-04 19:58:45 -0400 |
commit | a59b194a7b40a08dc3d3ffe01f7781acd43ae60f (patch) | |
tree | 21762a4a737068ee695fd63cac06788afda29f5c | |
parent | 796f5f9cc5c2e0c8aaeb4b4a13e184623d873b10 (diff) | |
download | illumos-joyent-a59b194a7b40a08dc3d3ffe01f7781acd43ae60f.tar.gz |
OS-8167 lx_upcall_statd() may hang-or-panic when trying to upcall (#299)
Reviewed by: Max Bruning <max@joyent.com>
Reviewed by: Jason King <jbk@joyent.com>
Approved by: Jason King <jbk@joyent.com>
-rw-r--r-- | usr/src/uts/common/brand/lx/os/lx_lockd.c | 13 |
1 files changed, 13 insertions, 0 deletions
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) { |