summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-08-17 09:30:42 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2026-08-17 09:30:42 -0700
commit3d1f95267769caf5c3eb71a2c9586213ea0a3ef2 (patch)
treedc0c9f9454152051dfb5daffe9d7010ed2646b4f
parentcd051cfe1e35a471fc2cdf6d32fae6ee23305ecb (diff)
parent9d7ed813ee5ff0d469bd99630828ed6fdef4e8da (diff)
Merge tag 'vfs-7.3-rc1.fat' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
Pull FAT update from Christian Brauner: "This rejects names longer than NAME_MAX in msdos_format_name(). The VFS only enforces PATH_MAX rather than the length of an individual component. open() on such a path component reported success for a name far longer than NAME_MAX" * tag 'vfs-7.3-rc1.fat' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs: fat: reject name longer than NAME_MAX in msdos_format_name()
-rw-r--r--fs/fat/namei_msdos.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/fat/namei_msdos.c b/fs/fat/namei_msdos.c
index 0fd2971ad4b1..c93e05d35ef8 100644
--- a/fs/fat/namei_msdos.c
+++ b/fs/fat/namei_msdos.c
@@ -29,6 +29,9 @@ static int msdos_format_name(const unsigned char *name, int len,
unsigned char c;
int space;
+ if (len > NAME_MAX)
+ return -ENAMETOOLONG;
+
if (name[0] == '.') { /* dotfile because . and .. already done */
if (opts->dotsOK) {
/* Get rid of dot - test for it elsewhere */