isofs: report the Joliet name length in statfs

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 f68e542f34 ("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>
Link: https://patch.msgid.link/20260926042916.3277409-3-matthias.goergens@gmail.com
Signed-off-by: Jan Kara <jack@suse.cz>
This commit is contained in:
Matthias Goergens 2026-09-26 12:29:14 +08:00 committed by Jan Kara
parent b8253bcf92
commit 1885d252b3

View File

@ -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;
}