mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthias Goergens <matthias.goergens@gmail.com>
To: Jan Kara <jack@suse.cz>
Cc: Christian Brauner <brauner@kernel.org>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 2/4] isofs: report the Joliet name length in statfs
Date: Sat, 26 Sep 2026 12:29:14 +0800	[thread overview]
Message-ID: <20260926042916.3277409-3-matthias.goergens@gmail.com> (raw)
In-Reply-To: <20260926042916.3277409-1-matthias.goergens@gmail.com>

isofs_statfs() reports NAME_MAX as the longest name, but a Joliet name
can now be up to JOLIET_NAME_MAX bytes long.  glibc answers
pathconf(_PC_NAME_MAX) from f_namelen, so a program sizing a buffer from
it should get room for every name readdir returns.  vfat has reported
255 times NLS_MAX_CHARSET_SIZE, 1530, since commit f68e542f3478 ("fat:
Fix statfs->f_namelen"), which followed a report of readdir_r()
overflowing a buffer sized that way, and exfat reports the same.
Windows reports a maximum component length of 110 for CDFS.

Report JOLIET_NAME_MAX on Joliet mounts.  Rock Ridge and plain ISO 9660
mounts keep NAME_MAX.

Signed-off-by: Matthias Goergens <matthias.goergens@gmail.com>
---
 fs/isofs/inode.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index b766b5c9c593..23c51eaf8356 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -1012,7 +1012,8 @@ static int isofs_statfs (struct dentry *dentry, struct kstatfs *buf)
 	buf->f_files = ISOFS_SB(sb)->s_ninodes;
 	buf->f_ffree = 0;
 	buf->f_fsid = u64_to_fsid(id);
-	buf->f_namelen = NAME_MAX;
+	buf->f_namelen = ISOFS_SB(sb)->s_joliet_level ?
+			 JOLIET_NAME_MAX : NAME_MAX;
 	return 0;
 }
 
-- 
2.55.0


  parent reply	other threads:[~2026-09-26  4:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-26  4:29 [PATCH v2 0/4] isofs: bound the name conversion and return long Joliet names whole Matthias Goergens
2026-09-26  4:29 ` [PATCH v2 1/4] isofs: " Matthias Goergens
2026-09-26  4:29 ` Matthias Goergens [this message]
2026-09-26  4:29 ` [PATCH v2 3/4] isofs: pass the name buffer size to get_rock_ridge_filename() Matthias Goergens
2026-09-26  4:29 ` [PATCH v2 4/4] isofs: shrink the name conversion buffer Matthias Goergens
2026-09-30 11:13 ` [PATCH v2 0/4] isofs: bound the name conversion and return long Joliet names whole Jan Kara

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=20260926042916.3277409-3-matthias.goergens@gmail.com \
    --to=matthias.goergens@gmail.com \
    --cc=brauner@kernel.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®