[PATCH v2 4/4] isofs: shrink the name conversion buffer

From: Matthias Goergens

Date: Sat Sep 26 2026 - 00:31:04 EST


isofs_readdir() and isofs_lookup() allocate 1024 bytes for the name
converters. Now that get_rock_ridge_filename() and
get_joliet_filename() are told the buffer size, nothing writes beyond
JOLIET_NAME_MAX + 1 bytes: get_joliet_filename() is passed that size,
get_rock_ridge_filename() is passed NAME_MAX + 1, isofs_name_translate()
copies at most the 222 bytes of name a directory record can hold, and
get_acorn_filename() appends at most five bytes to that.

Allocate JOLIET_NAME_MAX + 1 bytes, matching what the Joliet callers
pass.

No functional change.

Signed-off-by: Matthias Goergens <matthias.goergens@xxxxxxxxx>
---
fs/isofs/dir.c | 2 +-
fs/isofs/namei.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/isofs/dir.c b/fs/isofs/dir.c
index dd8958617340..8b5f03b696b2 100644
--- a/fs/isofs/dir.c
+++ b/fs/isofs/dir.c
@@ -236,7 +236,7 @@ static int isofs_readdir(struct file *file, struct dir_context *ctx)
char *tmpname;
struct inode *inode = file_inode(file);

- tmpname = kmalloc(1024, GFP_KERNEL);
+ tmpname = kmalloc(JOLIET_NAME_MAX + 1, GFP_KERNEL);
if (tmpname == NULL)
return -ENOMEM;

diff --git a/fs/isofs/namei.c b/fs/isofs/namei.c
index 9025ff74eb60..c2222504fde9 100644
--- a/fs/isofs/namei.c
+++ b/fs/isofs/namei.c
@@ -157,7 +157,7 @@ struct dentry *isofs_lookup(struct inode *dir, struct dentry *dentry, unsigned i
struct inode *inode;
char *tmpname;

- tmpname = kmalloc(1024, GFP_USER);
+ tmpname = kmalloc(JOLIET_NAME_MAX + 1, GFP_USER);
if (!tmpname)
return ERR_PTR(-ENOMEM);

--
2.55.0