Blame SOURCES/0047-exfat-fix-name_hash-computation-on-big-endian-system.patch

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