mirror of
https://github.com/torvalds/linux.git
synced 2026-09-12 12:34:02 +02:00
ntfs: return DT_UNKNOWN on inode lookup failure in readdir
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: fc053f05ca ("ntfs: add reparse and ea operations")
Signed-off-by: Baolin Liu <liubaolin@kylinos.cn>
Reviewed-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
This commit is contained in:
parent
45c13f3f9e
commit
3d3de2aee1
|
|
@ -405,7 +405,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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user