From: Viacheslav Dubeyko <slava@dubeyko.com>
To: Yangtao Li <frank.li@vivo.com>, glaubitz@physik.fu-berlin.de
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] hfs: abort hfs_lookup if name is too long
Date: Fri, 08 Aug 2025 15:05:27 -0700 [thread overview]
Message-ID: <201feccdf58b34a6d75285f74109528a66bdfd62.camel@dubeyko.com> (raw)
In-Reply-To: <20250806171132.3402278-2-frank.li@vivo.com>
On Wed, 2025-08-06 at 11:11 -0600, Yangtao Li wrote:
> Long file names for hfs is 31 characters.
>
Could this max name length affects the xfstests in the case if we
finally restricts the creation of files/folders with longer names?
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
> fs/hfs/dir.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c
> index 86a6b317b474..30f6194da939 100644
> --- a/fs/hfs/dir.c
> +++ b/fs/hfs/dir.c
> @@ -25,6 +25,9 @@ static struct dentry *hfs_lookup(struct inode *dir,
> struct dentry *dentry,
> struct inode *inode = NULL;
> int res;
>
> + if (dentry->d_name.len > HFS_NAMELEN)
> + return ERR_PTR(-ENAMETOOLONG);
> +
I think it makes sense to follow the HFS+ logic. We need to rework
hfs_cat_build_key() [1, 2] and hfs_asc2mac() [3]. It already operates
by -ENAMETOOLONG [4] but it is not we would like to have.
Thanks,
Slava.
> res = hfs_find_init(HFS_SB(dir->i_sb)->cat_tree, &fd);
> if (res)
> return ERR_PTR(res);
[1] https://elixir.bootlin.com/linux/v6.16/source/fs/hfs/dir.c#L31
[2] https://elixir.bootlin.com/linux/v6.16/source/fs/hfs/catalog.c#L28
[3] https://elixir.bootlin.com/linux/v6.16/source/fs/hfs/trans.c#L97
[4] https://elixir.bootlin.com/linux/v6.16/source/fs/hfs/trans.c#L125
next prev parent reply other threads:[~2025-08-08 22:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-06 17:11 [PATCH 0/2] hfs&hfsplus: abort for unexpected name length Yangtao Li
2025-08-06 17:11 ` [PATCH 1/2] hfs: abort hfs_lookup if name is too long Yangtao Li
2025-08-08 22:05 ` Viacheslav Dubeyko [this message]
2025-08-06 17:11 ` [PATCH 2/2] hfsplus: abort hfsplus_lookup " Yangtao Li
2025-08-08 21:54 ` Viacheslav Dubeyko
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=201feccdf58b34a6d75285f74109528a66bdfd62.camel@dubeyko.com \
--to=slava@dubeyko.com \
--cc=frank.li@vivo.com \
--cc=glaubitz@physik.fu-berlin.de \
--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;
as well as URLs for NNTP newsgroup(s).