From nobody Sat Oct 15 15:39:58 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MqSB63xmZz4fqw6; Sat, 15 Oct 2022 15:39:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MqSB637k9z3nr2; Sat, 15 Oct 2022 15:39:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665848398; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bhSymfmdoyINEJ1+Tc4ZGLfmXbLR7tOpBN6TwN6Eodo=; b=OVOHCWt8Enn3qU8+knvW6vd1G6hEfHqk2T+9E/q4n09uQZ4hL4+NHiPmTuea4hQUMRRbVe 7skVl+OYaqKJTZY80tR0dzO9W4hzRIkjIgOljlNTHTKOQrFrrRbJVt8yY7eCuDG7TQBlE8 TJ5wR/C7zs6yRyDfb46A7g7LeEwBKvWXJ82V5F4d0H/x7jpuBInMb607lnvZu+cBYmGlsU wGlHfGx3F5XD2gT2dEk7SqyMR4E4Cz34kAYCONd3S8uxgCI5s/UsPQ9EZOBIxMvHPq6549 SfOnlweTqbR7CUDrKjbaPtmAA6u5fLYosyfzoU8Sn5/JKDq0WFjn44fFqA+IQQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MqSB61xxJz197X; Sat, 15 Oct 2022 15:39:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 29FFdw6J003271; Sat, 15 Oct 2022 15:39:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 29FFdwwV003270; Sat, 15 Oct 2022 15:39:58 GMT (envelope-from git) Date: Sat, 15 Oct 2022 15:39:58 GMT Message-Id: <202210151539.29FFdwwV003270@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 7d9dc91a9901 - main - nfscl: Fix the NFSv4.0 mount so that it does not crash List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7d9dc91a9901689bbf263935ef1b04617a70efb0 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665848398; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bhSymfmdoyINEJ1+Tc4ZGLfmXbLR7tOpBN6TwN6Eodo=; b=T5oYXiMOjWvIwiESQ5tKomVNB2lpQh+dHy4HEDPqk1RASDv8PRCUNCTqycn4//F1Rv0ODc sO4vJSNv6rFIPyU8uM8mIRk7XOz4SptMI3ML0Yoy+FszFQkwLyhnUzadWiqUpGVZzc49QI iBiS4f2Kp1+0xEblm3mGviP+tsbsezdJlFICyXncg/GxOVTNw5WR70V8u43yUZH32cT/aN 81E9zlVx+HBJp0WY37oXZOj8iAjXWUPr895rCgZqq2ZrNCAcSHMoqjMoJm51XcelBAnv6V MLpZR0GYQmq01DqacY6o1+YlqgEMvs2YA0SR9rW4CAC0rdRrxFR1J575xr2jPg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1665848398; a=rsa-sha256; cv=none; b=MQcrXbycntluaZUzcBs7w1HjytTRNYZXFKBzCZOs883ph70KqlJl1aszEVfeH1pa0eQCXL O10a3aJitAQtZGNbRtBlC3adG5SCZMIrJ5ogNLji85+dO7bt0QJ+scNNrLnj8omiBeZ0GU HICWaodGIxJTfFSKGLZ5C5jXZTko7jJgHbq0j33Jj7Yi5EU+OKT53iBnsBxx1XQG0VaFrv cP38Xit1M6yHGKZOTJxIJT6YWYSdmou9sxl0UhPcVCRtWrP3xIG9iqWtqsSe7uugrxjyTm fa5+cmlcVuybfRoknPmWyFmosdYaEvFfF6RFuFMu3BxRl3sDJ3Is1E3JaHqlVg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=7d9dc91a9901689bbf263935ef1b04617a70efb0 commit 7d9dc91a9901689bbf263935ef1b04617a70efb0 Author: Rick Macklem AuthorDate: 2022-10-15 15:38:07 +0000 Commit: Rick Macklem CommitDate: 2022-10-15 15:38:07 +0000 nfscl: Fix the NFSv4.0 mount so that it does not crash Commit efe58855f3ea modifies IN_LOOPBACK() so that it uses a VNET variable. Without this patch, nfscl_getmyip() uses IN_LOOPBACK() when the VNET is not set and crashes the system. nfscl_getmyip() is only called when a NFSv4.0 (not NFSv4.1/4.2) mount is done. This patch re-organizes nfscl_getmyip() so that IN_LOOPBACK() is before the CURVENT_RESTORE() macro, to avoid the crashes. Reviewed by: karels, zlei.huang_gmail.com Differential Revision: https://reviews.freebsd.org/D37008 --- sys/fs/nfsclient/nfs_clport.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clport.c b/sys/fs/nfsclient/nfs_clport.c index e77aaccbc720..f5d7c3caea0f 100644 --- a/sys/fs/nfsclient/nfs_clport.c +++ b/sys/fs/nfsclient/nfs_clport.c @@ -1014,18 +1014,18 @@ nfscl_getmyip(struct nfsmount *nmp, struct in6_addr *paddr, int *isinet6p) NET_EPOCH_ENTER(et); CURVNET_SET(CRED_TO_VNET(nmp->nm_sockreq.nr_cred)); nh = fib4_lookup(fibnum, sin->sin_addr, 0, NHR_NONE, 0); - CURVNET_RESTORE(); - if (nh != NULL) + if (nh != NULL) { addr = IA_SIN(ifatoia(nh->nh_ifa))->sin_addr; + if (IN_LOOPBACK(ntohl(addr.s_addr))) { + /* Ignore loopback addresses */ + nh = NULL; + } + } + CURVNET_RESTORE(); NET_EPOCH_EXIT(et); - if (nh == NULL) - return (NULL); - if (IN_LOOPBACK(ntohl(addr.s_addr))) { - /* Ignore loopback addresses */ + if (nh == NULL) return (NULL); - } - *isinet6p = 0; *((struct in_addr *)paddr) = addr;