Re: [PATCH 1/2] ntfs: apply Windows name checks only with windows_names

Hyunchul Lee <[email protected]> Mon, 27 Jul 2026 10:49:28 +0900
Newsgroups dev.linux.lists.ntfs
Message-ID <CANFS6bYpvf=zCmj+pe=xQj0C--K8JX0AYPQ8OKXhXyYwb=+6Fg@mail.gmail.com>
2026=EB=85=84 7=EC=9B=94 25=EC=9D=BC (=ED=86=A0) =EC=98=A4=EC=A0=84 12:49, =
Namjae Jeon <[email protected]>=EB=8B=98=EC=9D=B4 =EC=9E=91=EC=84=B1:
>
> The windows_names mount option is documented to reject names containing
> characters forbidden by Windows. However, ntfs_check_bad_windows_name()
> unconditionally rejects those characters before checking the mount option=
.
>
> Move the character validation after the option check so a default NTFS
> mount accepts POSIX names such as names containing ':'. Mounts using
> windows_names retain the existing Windows-compatible validation, includin=
g
> reserved device names and trailing spaces or dots.
>
> Signed-off-by: Namjae Jeon <[email protected]>

Looks good to me.

Reviewed-by: Hyunchul Lee <[email protected]>

> ---
>  fs/ntfs/namei.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/fs/ntfs/namei.c b/fs/ntfs/namei.c
> index cd403b1d99ee..aee7aabaf059 100644
> --- a/fs/ntfs/namei.c
> +++ b/fs/ntfs/namei.c
> @@ -61,12 +61,12 @@ static int ntfs_check_bad_windows_name(struct ntfs_vo=
lume *vol,
>                                        const __le16 *wc,
>                                        unsigned int wc_len)
>  {
> -       if (ntfs_check_bad_char(wc, wc_len))
> -               return -EINVAL;
> -
>         if (!NVolCheckWindowsNames(vol))
>                 return 0;
>
> +       if (ntfs_check_bad_char(wc, wc_len))
> +               return -EINVAL;
> +
>         /* Check for trailing space or dot. */
>         if (wc_len > 0 &&
>             (wc[wc_len - 1] =3D=3D cpu_to_le16(' ') ||
> --
> 2.25.1
>


--=20
Thanks,
Hyunchul