]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
struct filename: saner handling of long names
authorAl Viro <viro@zeniv.linux.org.uk>
Thu, 20 Nov 2025 00:45:04 +0000 (19:45 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 13 Jan 2026 20:16:44 +0000 (15:16 -0500)
commit8c888b31903cc2acfbf054c23d702caf68857810
treeb8677601b8a43f4fec6990d12ca1a07fbcd74a60
parentc3a3577cdb351e74d6ff6bc328c3bee18ce69298
struct filename: saner handling of long names

Always allocate struct filename from names_cachep, long name or short;
short names would be embedded into struct filename.  Longer ones do
not cannibalize the original struct filename - put them into kmalloc'ed
buffers (PATH_MAX-sized for import from userland, strlen() + 1 - for
ones originating kernel-side, where we know the length beforehand).

Cutoff length for short names is chosen so that struct filename would be
192 bytes long - that's both a multiple of 64 and large enough to cover
the majority of real-world uses.

Simplifies logics in getname()/putname() and friends.

[fixed an embarrassing braino in EMBEDDED_NAME_MAX, first reported by
Dan Carpenter]

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/namei.c
include/linux/fs.h