diff options
| author | Haobin Wu <853555@gmail.com> | 2026-09-18 10:48:50 +0800 |
|---|---|---|
| committer | Dominique Martinet <asmadeus@codewreck.org> | 2026-09-22 08:10:39 +0000 |
| commit | edd807dc2031c62f8358b81a48956ac762bc8a1d (patch) | |
| tree | b0a3e325d55db79904ab26fa21bf694da96c19ec /scripts/basic | |
| parent | 8bb0279930cc90975f03bad4d83282613e5f57fa (diff) | |
| download | linux-edd807dc2031c62f8358b81a48956ac762bc8a1d.tar.gz linux-edd807dc2031c62f8358b81a48956ac762bc8a1d.zip | |
9p: skip directory entries with names longer than NAME_MAX
The 9p wire format carries directory entry names of up to 65535 bytes
and nothing on the client checks them against NAME_MAX. Since the
previous patch, v9fs_dir_readdir_dotl() passes such names straight to
dir_emit(), and the VFS only rejects names of PATH_MAX bytes or more in
verify_dirent_name(), as -EIO, which again fails the whole getdents64()
call.
A name between NAME_MAX and PATH_MAX is therefore returned to userspace
even though every later operation on it fails with -ENAMETOOLONG, and
POSIX requires readdir() to only return components of at most NAME_MAX
bytes. Nothing can use such an entry, so skip it instead of returning it
or failing the listing, reusing the strlen() result that was already
computed for dir_emit(). Log the skipped entry at P9_DEBUG_ERROR, the
same level as the strscpy() failure message this replaces.
Suggested-by: Dominique Martinet <asmadeus@codewreck.org>
Link: https://lore.kernel.org/all/vz5bum547fqyxf5z4m3x7tuqkuq52jlopm65t7hvynqeulh7i3@2t4wnhfxs7qv/
Signed-off-by: Haobin Wu <853555@gmail.com>
Reviewed-by: Christian Schoenebeck <linux_oss@crudebyte.com>
Message-ID: <20260918024851.51229-3-853555@gmail.com>
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
Diffstat (limited to 'scripts/basic')
0 files changed, 0 insertions, 0 deletions
