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 4/4] isofs: shrink the name conversion buffer
Date: Sat, 26 Sep 2026 12:29:16 +0800	[thread overview]
Message-ID: <20260926042916.3277409-5-matthias.goergens@gmail.com> (raw)
In-Reply-To: <20260926042916.3277409-1-matthias.goergens@gmail.com>

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@gmail.com>
---
 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


  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 ` [PATCH v2 2/4] isofs: report the Joliet name length in statfs Matthias Goergens
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 ` Matthias Goergens [this message]
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-5-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®