From nobody Fri Oct 31 01:15:08 2025 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 4cyNM124kWz6Df95; Fri, 31 Oct 2025 01:15:09 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cyNM119Fkz3pTX; Fri, 31 Oct 2025 01:15:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1761873309; 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=rd9a4POgAEeYdL4s+M96n4rk17JirzfnAd8ykfMPCAE=; b=bStLUhTcRYnUKo/hjj/HuTelQFOMEWaSTnn+KG84vECASLus8gbSjn/1rEOpgkAZuvIU1O jC55h1vmgmT4T71JJg2eZ8sKRmSO93XDluJR112UL2WY/aAbRSmIKYMiijDJTFgH3ZpJNk qDhNjePH/Q87kx8Kmu7Vt9MZAOM6jeA2DzeYa/j7N9+62+m+hC2O0UrI537bw3n3VBejAk zHK0Z8zsw45Myzt0enesNzB0TbRSMYmdxZUi4UAGXVlfMbIFeTICKbb7EV/D/2H5+PzzzS krctpTQbFQhKKDfbsa1sYQ6CrhUcuI0v9elKvSaalXglqAxclOjQPg3fiArHpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1761873309; 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=rd9a4POgAEeYdL4s+M96n4rk17JirzfnAd8ykfMPCAE=; b=WS7QU22l6WjsVV3BWAoPLVVCnnOf0axvuEEMUyhH5s+1OhT1MVtIrxILRBvwUAEpCjU3CV 35L5FIMhmMzvlBjL0NiW5+ULZXXC/KJvY2qVRb7VQZA/v1cNfNkiFS1HiAA5qCVYLMEDFo FUzhwlSbBT4R58QKHaH1xjYYCt4LIL8Hxr8JHjU3iavk7wi7fpj3V0m2XGeAqioVOJnrz8 MDDRmujVazfi9oeDh5ehYlPg12zNzg5qxlyW0qH0cJ7Y7vAC3sxuwEigID0nS/fjii4HNS iCbwShTkDwOkvgQSnzk4scdeOcwK68avsvqsfYuRtgXUAlDwCpSzNQvjxwB2HA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1761873309; a=rsa-sha256; cv=none; b=R4/7YcPdWZNx2cr817Z5Z/KX5zx6j/FtvQmDDn/BvjJoLRPJeir94ROzJZw0+K/Ojtb81b 9h/ZpAZ/h02V1uVmcHIpVYCglZVVk2i+kNERV2Jclsf59E529JCpYzJQKH8JNtp/4ZamBW EFd/WO1ITuQLxZ2qRVwYQzFAR77eSC7c9LD9zeq8btUTxBQkFsd6wJcEj+lDLKTi+BBkEL axIiIim1jXTrcIoZ2U0uMcu+vP++h+CAUvAjtUrV7b4ioyY6/QRLheTld6ZGLH+tleSb3E v/bmVefAj75Bn7n3UW27z6LZNqnvEeHubwkXj9kGbTB8kb21I08M1iDQvTMjfA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4cyNM10fPNznZ6; Fri, 31 Oct 2025 01:15:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 59V1F8Lx041413; Fri, 31 Oct 2025 01:15:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 59V1F8sv041410; Fri, 31 Oct 2025 01:15:08 GMT (envelope-from git) Date: Fri, 31 Oct 2025 01:15:08 GMT Message-Id: <202510310115.59V1F8sv041410@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: 7a5208998bc9 - stable/14 - nfs_clrpcops.c: NFSM_DISSECT() reply for each dir separately 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-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/14 X-Git-Reftype: branch X-Git-Commit: 7a5208998bc927be3939331a433f44a9ee16712e Auto-Submitted: auto-generated The branch stable/14 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=7a5208998bc927be3939331a433f44a9ee16712e commit 7a5208998bc927be3939331a433f44a9ee16712e Author: Rick Macklem AuthorDate: 2025-10-28 21:31:30 +0000 Commit: Rick Macklem CommitDate: 2025-10-31 01:12:16 +0000 nfs_clrpcops.c: NFSM_DISSECT() reply for each dir separately Without this patch, the entire reply for all directories in the NFSv4 mount path are parsed at once. This could cause problems for mount paths with many directories in the path. This patch fixes the problem by parsing each directory reply in a loop. Spotted while fixing other cases that could do large NFSM_DISSECT() sizes. (cherry picked from commit 9d13c87afdb35c0014aa6f43c5652e946c18b756) --- sys/fs/nfsclient/nfs_clrpcops.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index c5483623a9a5..387c5465618a 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -5157,7 +5157,7 @@ nfsrpc_getdirpath(struct nfsmount *nmp, u_char *dirpath, struct ucred *cred, struct nfsrv_descript nfsd; struct nfsrv_descript *nd = &nfsd; u_char *cp, *cp2, *fhp; - int error, cnt, len, setnil; + int error, cnt, i, len, setnil; u_int32_t *opcntp; nfscl_reqstart(nd, NFSPROC_PUTROOTFH, nmp, NULL, 0, &opcntp, NULL, 0, @@ -5198,8 +5198,12 @@ nfsrpc_getdirpath(struct nfsmount *nmp, u_char *dirpath, struct ucred *cred, if (error) return (error); if (nd->nd_repstat == 0) { - NFSM_DISSECT(tl, u_int32_t *, (3 + 2 * cnt) * NFSX_UNSIGNED); - tl += (2 + 2 * cnt); + NFSM_DISSECT(tl, uint32_t *, 3 * NFSX_UNSIGNED); + tl += 2; + for (i = 0; i < cnt; i++) { + NFSM_DISSECT(tl, uint32_t *, 2 * NFSX_UNSIGNED); + tl++; + } if ((len = fxdr_unsigned(int, *tl)) <= 0 || len > NFSX_FHMAX) { nd->nd_repstat = NFSERR_BADXDR;