mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
ntfs: return -EINVAL from ntfs_collate_ntofs_ulongs() on bad length
ntfs_collate_ntofs_ulongs() returns -1 when the key lengths differ or are
not a multiple of 4. But -1 is also what cmp_int() returns for "collates
before", so the error is indistinguishable from an ordinary result.
ntfs_ie_lookup() acts on that difference: it maps -EINVAL to -ERANGE, but
treats -1 as a tree-descent hint and breaks out of the loop. A malformed
entry in $Reparse/$R or $ObjId/$O is therefore silently taken as a lookup
miss.
Return -EINVAL, as the sibling ntfs_collate_ntofs_ulong() already does.
Well-formed keys are unaffected; both indexes use key sizes that are
multiples of 4.
Fixes: 5218cd102a ("ntfs: update misc 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
34ed307206
commit
41001a72da
|
|
@ -73,7 +73,7 @@ static int ntfs_collate_ntofs_ulongs(struct ntfs_volume *vol,
|
|||
|
||||
if (data1_len != data2_len || data1_len & 3) {
|
||||
ntfs_error(vol->sb, "data1_len or data2_len not valid\n");
|
||||
return -1;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
len = data1_len;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user