|
Kmods SIG |
9e3ffb |
From db415f7aae07cadcabd5d2a659f8ad825c905299 Mon Sep 17 00:00:00 2001
|
|
Kmods SIG |
9e3ffb |
From: Ilya Ponetayev <i.ponetaev@ndmsystems.com>
|
|
Kmods SIG |
9e3ffb |
Date: Thu, 16 Jul 2020 17:27:53 +0900
|
|
Kmods SIG |
9e3ffb |
Subject: [Backport db415f7aae07] exfat: fix name_hash computation on big
|
|
Kmods SIG |
9e3ffb |
endian systems
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
On-disk format for name_hash field is LE, so it must be explicitly
|
|
Kmods SIG |
9e3ffb |
transformed on BE system for proper result.
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
Fixes: 370e812b3ec1 ("exfat: add nls operations")
|
|
Kmods SIG |
9e3ffb |
Cc: stable@vger.kernel.org # v5.7
|
|
Kmods SIG |
9e3ffb |
Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
|
|
Kmods SIG |
9e3ffb |
Signed-off-by: Ilya Ponetayev <i.ponetaev@ndmsystems.com>
|
|
Kmods SIG |
9e3ffb |
Reviewed-by: Sungjong Seo <sj1557.seo@samsung.com>
|
|
Kmods SIG |
9e3ffb |
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
|
|
Kmods SIG |
9e3ffb |
---
|
|
Kmods SIG |
9e3ffb |
src/nls.c | 8 ++++----
|
|
Kmods SIG |
9e3ffb |
1 file changed, 4 insertions(+), 4 deletions(-)
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
diff --git a/src/nls.c b/src/nls.c
|
|
Kmods SIG |
9e3ffb |
index 57b5a7a4d1f7a18b1854348bd6841ea7bc9c466a..a3c927501e676f3b240eca17106b07a296d99e6f 100644
|
|
Kmods SIG |
9e3ffb |
--- a/src/nls.c
|
|
Kmods SIG |
9e3ffb |
+++ b/src/nls.c
|
|
Kmods SIG |
9e3ffb |
@@ -495,7 +495,7 @@ static int exfat_utf8_to_utf16(struct super_block *sb,
|
|
Kmods SIG |
9e3ffb |
struct exfat_uni_name *p_uniname, int *p_lossy)
|
|
Kmods SIG |
9e3ffb |
{
|
|
Kmods SIG |
9e3ffb |
int i, unilen, lossy = NLS_NAME_NO_LOSSY;
|
|
Kmods SIG |
9e3ffb |
- unsigned short upname[MAX_NAME_LENGTH + 1];
|
|
Kmods SIG |
9e3ffb |
+ __le16 upname[MAX_NAME_LENGTH + 1];
|
|
Kmods SIG |
9e3ffb |
unsigned short *uniname = p_uniname->name;
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
WARN_ON(!len);
|
|
Kmods SIG |
9e3ffb |
@@ -519,7 +519,7 @@ static int exfat_utf8_to_utf16(struct super_block *sb,
|
|
Kmods SIG |
9e3ffb |
exfat_wstrchr(bad_uni_chars, *uniname))
|
|
Kmods SIG |
9e3ffb |
lossy |= NLS_NAME_LOSSY;
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
- upname[i] = exfat_toupper(sb, *uniname);
|
|
Kmods SIG |
9e3ffb |
+ upname[i] = cpu_to_le16(exfat_toupper(sb, *uniname));
|
|
Kmods SIG |
9e3ffb |
uniname++;
|
|
Kmods SIG |
9e3ffb |
}
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
@@ -597,7 +597,7 @@ static int exfat_nls_to_ucs2(struct super_block *sb,
|
|
Kmods SIG |
9e3ffb |
struct exfat_uni_name *p_uniname, int *p_lossy)
|
|
Kmods SIG |
9e3ffb |
{
|
|
Kmods SIG |
9e3ffb |
int i = 0, unilen = 0, lossy = NLS_NAME_NO_LOSSY;
|
|
Kmods SIG |
9e3ffb |
- unsigned short upname[MAX_NAME_LENGTH + 1];
|
|
Kmods SIG |
9e3ffb |
+ __le16 upname[MAX_NAME_LENGTH + 1];
|
|
Kmods SIG |
9e3ffb |
unsigned short *uniname = p_uniname->name;
|
|
Kmods SIG |
9e3ffb |
struct nls_table *nls = EXFAT_SB(sb)->nls_io;
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
@@ -611,7 +611,7 @@ static int exfat_nls_to_ucs2(struct super_block *sb,
|
|
Kmods SIG |
9e3ffb |
exfat_wstrchr(bad_uni_chars, *uniname))
|
|
Kmods SIG |
9e3ffb |
lossy |= NLS_NAME_LOSSY;
|
|
Kmods SIG |
9e3ffb |
|
|
Kmods SIG |
9e3ffb |
- upname[unilen] = exfat_toupper(sb, *uniname);
|
|
Kmods SIG |
9e3ffb |
+ upname[unilen] = cpu_to_le16(exfat_toupper(sb, *uniname));
|
|
Kmods SIG |
9e3ffb |
uniname++;
|
|
Kmods SIG |
9e3ffb |
unilen++;
|
|
Kmods SIG |
9e3ffb |
}
|
|
Kmods SIG |
9e3ffb |
--
|
|
Kmods SIG |
9e3ffb |
2.31.1
|
|
Kmods SIG |
9e3ffb |
|