All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chen Hanxiao <chenhx.fnst@fujitsu.com>
To: Steve Dickson <steved@redhat.com>
Cc: linux-nfs@vger.kernel.org
Subject: [nfs-utils PATCH] mount: reject "namlen=" option for a NFSv4 mount
Date: Fri, 22 Mar 2024 18:36:18 +0800	[thread overview]
Message-ID: <20240322103618.1270-1-chenhx.fnst@fujitsu.com> (raw)

namlen is not a valid option for NFSv4.
Currently, we could pass a namlen=xxx in a NFSv4 mount,
the mount command succeed and namlen is ignored silently

# mount -o vers=4,namlen=100 192.168.122.19:/nfsroot /mnt/ -vvv
mount.nfs: timeout set for Fri Mar 22 14:22:18 2024
mount.nfs: trying text-based options 'namlen=100,vers=4.2,
	   addr=192.168.122.19,clientaddr=192.168.122.15'

This patch reject "namlen=" option in a NFSv4 mount.

Signed-off-by: Chen Hanxiao <chenhx.fnst@fujitsu.com>
---
 utils/mount/stropts.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
index dbdd11e7..028ff6a6 100644
--- a/utils/mount/stropts.c
+++ b/utils/mount/stropts.c
@@ -780,6 +780,15 @@ static int nfs_do_mount_v4(struct nfsmount_info *mi,
 		goto out_fail;
 	}
 
+	if (po_contains(options, "namlen")) {
+		if (verbose) {
+			printf(_("%s: Unsupported nfs4 mount option(s) passed '%s'\n"),
+				progname, *mi->extra_opts);
+		}
+		errno = EINVAL;
+		goto out_fail;
+	}
+
 	if (mi->version.v_mode != V_SPECIFIC) {
 		char *fmt;
 		switch (mi->version.minor) {
-- 
2.39.1


             reply	other threads:[~2024-03-22 10:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-22 10:36 Chen Hanxiao [this message]
2024-04-02 16:20 ` [nfs-utils PATCH] mount: reject "namlen=" option for a NFSv4 mount Steve Dickson
2024-04-03  3:13   ` Hanxiao Chen (Fujitsu)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240322103618.1270-1-chenhx.fnst@fujitsu.com \
    --to=chenhx.fnst@fujitsu.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=steved@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.