From nobody Wed May 17 22:20:17 2023 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 4QM6xF6khBz4BfkG; Wed, 17 May 2023 22:20:17 +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 4QM6xF6BBzz3KY1; Wed, 17 May 2023 22:20:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684362017; 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=WGW8Md8LxzDJi6GemuGRWb0wVHocvoX0F10i2E0z1dw=; b=MvVAG0RePrhwMDcm92SNWLWDLQ5dUwiaPOx+YQfQ43Gs3fs5YwlcIaOTYyLnrwOfOy+uYP b71HbBvji/Eqw+dpftHDsKCPA7bIf/pxuGBy12JiSUaSbRaZTERplnqcIEtg9DkEatGePS tL6R7b+H/vHvfvMWXqzvYdUGVIAYYPLjJBOjSdEfCZifvjIQVLQGBC9lK6/NIEz08zxing bhBh7BZ804CYsPAchqcFjBT/fr2Uum9mJ9tbrcrnxNIK4NGW9axmymKnz0D7t31wuCVGP1 vTCAgojNBSwHehhRK331QqMCObf7qmDM2/2f+/VsN2QKxESs4APFR/Bgj9P3pA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684362017; 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=WGW8Md8LxzDJi6GemuGRWb0wVHocvoX0F10i2E0z1dw=; b=UrpmlrXKJbQ4A72oOTIJ+u2xCp+zEnzfiX6dTW7i0gka6hMaS6BXsCHtuYk8ACKpSrZ9oi /coozHBpKColEm808lxzmKazPg08AOiuQmAAnWqnIyMny01CMZNdlwNpRdknvfjgft9x1S fT6gl+dzJAOm/M6XGD+gvSnRR95FHhzZpTImW6GVILTujq+/0VcV50dlVRMNC38innt7ER 3E7gI7k1as/Z7kzKKBMrZbpp9T7ph/tsUUum4zTCfL/SblGaqfUmJMzAGwrkAOSGfF/eiC 0hBfpd7XQ4OS/jn/Y6UEnxEOAKyY0oBJyw3MJaLobRqInOjFudv9U+n2TsVttw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1684362017; a=rsa-sha256; cv=none; b=Q1ZkXnt5jZYaGNturUx3/DrWq3ZUrwR3d084CKB7HDgkNQ3oWAJe3guhgV7OYpv7KBFoJD Z9Rd3W/9PQbTKgQkqrmBCk27q6eKq16U7TRzWJBkCb3w/4ZEtnNMMEXY7B345xDHfT6yrl NX+DCSemUSnN4sBcJw2omGtcQr4npte9Xg5fe/Ap8xDMkyPjo51NiPn8Z7ln+9y1OHg7Vw tgg2GUjfyx+NQwNPnK14h2ZNJdnZojUZQ6QO3DWNb10lnadnXIuDSkWOujjkEtL2CbxgJQ vfCw4rr1tNAJLZknxL5y2x43Sltmp2ZOvATei2bNu6mXTqd4JrqalHEAY82Sbg== 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 4QM6xF5FynzLN6; Wed, 17 May 2023 22:20:17 +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 34HMKHNf067450; Wed, 17 May 2023 22:20:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 34HMKHaE067449; Wed, 17 May 2023 22:20:17 GMT (envelope-from git) Date: Wed, 17 May 2023 22:20:17 GMT Message-Id: <202305172220.34HMKHaE067449@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 8d7d3c6963f8 - stable/13 - nfscl: Add NFSD_CURVNET macros to nfsclient syscall 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 8d7d3c6963f8d504e0d02353bacce767a907ca5d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=8d7d3c6963f8d504e0d02353bacce767a907ca5d commit 8d7d3c6963f8d504e0d02353bacce767a907ca5d Author: Rick Macklem AuthorDate: 2023-02-21 00:40:07 +0000 Commit: Rick Macklem CommitDate: 2023-05-17 22:19:19 +0000 nfscl: Add NFSD_CURVNET macros to nfsclient syscall Although the nfsclient syscall is used for client side, it does set up server side krpc for callbacks. As such, it needs to have the vnet set. This patch does this. Without this patch, the system would crash when the nfscbd(8) daemon was killed. (cherry picked from commit 357492c99597d13bc966441f30bb44f6ef659f08) --- sys/fs/nfsclient/nfs_clport.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clport.c b/sys/fs/nfsclient/nfs_clport.c index 4d8599c18363..1d2617b2bb9b 100644 --- a/sys/fs/nfsclient/nfs_clport.c +++ b/sys/fs/nfsclient/nfs_clport.c @@ -1276,10 +1276,11 @@ nfssvc_nfscl(struct thread *td, struct nfssvc_args *uap) struct mount *mp; struct nfsmount *nmp; + NFSD_CURVNET_SET(NFSD_TD_TO_VNET(td)); if (uap->flag & NFSSVC_CBADDSOCK) { error = copyin(uap->argp, (caddr_t)&nfscbdarg, sizeof(nfscbdarg)); if (error) - return (error); + goto out; /* * Since we don't know what rights might be required, * pretend that we need them all. It is better to be too @@ -1288,10 +1289,11 @@ nfssvc_nfscl(struct thread *td, struct nfssvc_args *uap) error = fget(td, nfscbdarg.sock, cap_rights_init_one(&rights, CAP_SOCK_CLIENT), &fp); if (error) - return (error); + goto out; if (fp->f_type != DTYPE_SOCKET) { fdrop(fp, td); - return (EPERM); + error = EPERM; + goto out; } error = nfscbd_addsock(fp); fdrop(fp, td); @@ -1300,12 +1302,14 @@ nfssvc_nfscl(struct thread *td, struct nfssvc_args *uap) nfscl_enablecallb = 1; } } else if (uap->flag & NFSSVC_NFSCBD) { - if (uap->argp == NULL) - return (EINVAL); + if (uap->argp == NULL) { + error = EINVAL; + goto out; + } error = copyin(uap->argp, (caddr_t)&nfscbdarg2, sizeof(nfscbdarg2)); if (error) - return (error); + goto out; error = nfscbd_nfsd(td, &nfscbdarg2); } else if (uap->flag & NFSSVC_DUMPMNTOPTS) { error = copyin(uap->argp, &dumpmntopts, sizeof(dumpmntopts)); @@ -1391,6 +1395,8 @@ nfssvc_nfscl(struct thread *td, struct nfssvc_args *uap) } else { error = EINVAL; } +out: + NFSD_CURVNET_RESTORE(); return (error); }