From nobody Tue Oct 28 21:34:23 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 4cx3YD037Vz6DWHq; Tue, 28 Oct 2025 21:34:24 +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 4cx3YC6ThLz3nWB; Tue, 28 Oct 2025 21:34:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1761687263; 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=aZiOixhi8PFJ6RkuYTLEGm3NmyQZSlIa91V2Y1fIlJw=; b=uZS3geXVxroZBTr9yp+ZM1yTO6iLdETis0OF44L+kqSw9pkkIWp2VpOihfOnlrj2HxX6Dh K0SmH88q9tqbGQvxFbhXs/kDlZnIeFoZzDZZUCxxCJhfnx0SgsS3Zn/x3CB44H/G8+mM1v +IYBFsPWpseZotzymOJ/4Vd6Wc7ttwMR8oHQvEfZ4CzW4reAnQnYUdvXrn+FrYmOzNkJch vlzSsfIELXt0V4XNLkugOldW6KZ0EuIOYp1Jh10GLPKPQ98L85Uiw/U3AlazCSsReUECVM p3V1CQvdQdLZ1+ZuvqwDtmeUXm8A0XciYOWCti4Mp15kjLAKCVXJ5Uni51kPiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1761687263; 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=aZiOixhi8PFJ6RkuYTLEGm3NmyQZSlIa91V2Y1fIlJw=; b=FSqFnKgeUJFGonVrtldcW+5QEC/jbn89E0QPBm1UWUwce7xg1Q/YD3ugmFCIBjds0+Fc1b 3Tz1Zd1gpFztF4vxtGPPslZ1VCpu75OznsxWJl6Hf+jdSNxO46Sc4+BNdGMgSZQ5zcbj74 JPwf5pFSdWvnuQFPMG2NvT7ylM5dBYPSBnA0LYL8YSFe7eeckNNW1veYWLv8Bx1L/j1mFY mn3x2WI0MowH6U0q697jySR1izsE0JMPJRkpUOT4z0EsOMqDEf0hMKsgx4sf/E/C8O5vDq ZPKpz1zfN1rV8hBDZSdV/scEruNpiUc3WYLObmzCu7zohVT+yQVQR2RvYEvQHA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1761687263; a=rsa-sha256; cv=none; b=jvj99TuHXjFOs4gyS9XQVOJr1sdzp1k7PZ+KREqo81V5TzT0L+KgY2FJoTcKAs7wbObyjn RNb7igjZok3DukAVkp4W+gZ9VV9BHybrhU59Gwc5dPwG7FI6u8ufZvFsaDoDEINTJMEg2S HNV2eaU03LG1sLZ1SXtDYBUg4/Enb+jj9mTPQSb5ewy5XCjM4znA//P9h1cMK4fsxNeux4 A20mONd5DdfxPqjX3i8jPHs1gPWd1IteSg5894RT/e0oEAvf7mhnbjJvlrEw/2QNdcKiXR KE9d7+f7WodID6A7IPJF6MS0TB3Z2feCw3q2SA/4vpD7jBUAvf/8l7QcO+9yWQ== 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 4cx3YC64Nxz16J1; Tue, 28 Oct 2025 21:34:23 +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 59SLYNpS094919; Tue, 28 Oct 2025 21:34:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 59SLYN4g094916; Tue, 28 Oct 2025 21:34:23 GMT (envelope-from git) Date: Tue, 28 Oct 2025 21:34:23 GMT Message-Id: <202510282134.59SLYN4g094916@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: 9d13c87afdb3 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 9d13c87afdb35c0014aa6f43c5652e946c18b756 Auto-Submitted: auto-generated The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=9d13c87afdb35c0014aa6f43c5652e946c18b756 commit 9d13c87afdb35c0014aa6f43c5652e946c18b756 Author: Rick Macklem AuthorDate: 2025-10-28 21:31:30 +0000 Commit: Rick Macklem CommitDate: 2025-10-28 21:31:30 +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. MFC after: 3 days --- 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 983eb8b9226f..b88169ba69d5 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -5284,7 +5284,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, @@ -5325,8 +5325,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;