Skip to content
Permalink
Browse files
fs/ntfs3: fix endian conversion in ni_fname_name
ni_fname_name called ntfs_cmp_names_cpu which assumes that the first
string is in CPU byte order and the second one in little endian.
In this case both strings are little endian so ntfs_cmp_names is the
correct function to call.

Signed-off-by: Thomas Kühnel <thomas.kuehnel@avm.de>
Reviewed-by: Nicolas Schier <n.schier@avm.de>
  • Loading branch information
Thomas Kühnel authored and intel-lab-lkp committed Dec 7, 2021
1 parent 0fcfb00 commit d2fb837ced1828c5a57feac3690d3cc8a36b2fdc
Showing 1 changed file with 3 additions and 1 deletion.
@@ -1588,6 +1588,7 @@ struct ATTR_FILE_NAME *ni_fname_name(struct ntfs_inode *ni,
{
struct ATTRIB *attr = NULL;
struct ATTR_FILE_NAME *fname;
struct le_str *fns;

*le = NULL;

@@ -1610,7 +1611,8 @@ struct ATTR_FILE_NAME *ni_fname_name(struct ntfs_inode *ni,
if (uni->len != fname->name_len)
goto next;

if (ntfs_cmp_names_cpu(uni, (struct le_str *)&fname->name_len, NULL,
fns = (struct le_str *)&fname->name_len;
if (ntfs_cmp_names(uni->name, uni->len, fns->name, fns->len, NULL,
false))
goto next;

0 comments on commit d2fb837

Please sign in to comment.