Re: [PATCH v1 1/9] ntfs: return DT_UNKNOWN on inode lookup failure in readdir
From: Hyunchul Lee
Date: Mon Aug 24 2026 - 01:07:16 EST
2026년 8월 21일 (금) 오후 2:33, Baolin Liu <liubaolin12138@xxxxxxx>님이 작성:
>
> From: Baolin Liu <liubaolin@xxxxxxxxxx>
>
> ntfs_reparse_tag_dt_types() returns PTR_ERR(vi) when ntfs_iget()
> fails, but its return type is unsigned int and the caller passes
> the value straight to dir_emit() as d_type. A stale or corrupt MFT
> reference in a directory index thus makes readdir report a garbage
> d_type value to userspace.
>
> Return DT_UNKNOWN on lookup failure instead.
>
> Fixes: fc053f05ca28 ("ntfs: add reparse and ea operations")
> Signed-off-by: Baolin Liu <liubaolin@xxxxxxxxxx>
Looks good to me.
Reviewed-by: Hyunchul Lee <hyc.lee@xxxxxxxxx>
> ---
> fs/ntfs/reparse.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ntfs/reparse.c b/fs/ntfs/reparse.c
> index 0d3988992119..a8e413c61353 100644
> --- a/fs/ntfs/reparse.c
> +++ b/fs/ntfs/reparse.c
> @@ -331,7 +331,7 @@ unsigned int ntfs_reparse_tag_dt_types(struct ntfs_volume *vol, unsigned long mr
>
> vi = ntfs_iget(vol->sb, mref);
> if (IS_ERR(vi))
> - return PTR_ERR(vi);
> + return DT_UNKNOWN;
>
> reparse_attr = (struct reparse_point *)ntfs_attr_readall(NTFS_I(vi),
> AT_REPARSE_POINT, NULL, 0, &attr_size);
> --
> 2.51.0
>
>
--
Thanks,
Hyunchul