[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200727134934.132666901@linuxfoundation.org>
Date: Mon, 27 Jul 2020 16:03:25 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Chen Minqiang <ptpt52@...il.com>,
Ilya Ponetayev <i.ponetaev@...systems.com>,
Sungjong Seo <sj1557.seo@...sung.com>,
Namjae Jeon <namjae.jeon@...sung.com>
Subject: [PATCH 5.7 030/179] exfat: fix name_hash computation on big endian systems
From: Ilya Ponetayev <i.ponetaev@...systems.com>
commit db415f7aae07cadcabd5d2a659f8ad825c905299 upstream.
On-disk format for name_hash field is LE, so it must be explicitly
transformed on BE system for proper result.
Fixes: 370e812b3ec1 ("exfat: add nls operations")
Cc: stable@...r.kernel.org # v5.7
Signed-off-by: Chen Minqiang <ptpt52@...il.com>
Signed-off-by: Ilya Ponetayev <i.ponetaev@...systems.com>
Reviewed-by: Sungjong Seo <sj1557.seo@...sung.com>
Signed-off-by: Namjae Jeon <namjae.jeon@...sung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
fs/exfat/nls.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--- a/fs/exfat/nls.c
+++ b/fs/exfat/nls.c
@@ -495,7 +495,7 @@ static int exfat_utf8_to_utf16(struct su
struct exfat_uni_name *p_uniname, int *p_lossy)
{
int i, unilen, lossy = NLS_NAME_NO_LOSSY;
- unsigned short upname[MAX_NAME_LENGTH + 1];
+ __le16 upname[MAX_NAME_LENGTH + 1];
unsigned short *uniname = p_uniname->name;
WARN_ON(!len);
@@ -523,7 +523,7 @@ static int exfat_utf8_to_utf16(struct su
exfat_wstrchr(bad_uni_chars, *uniname))
lossy |= NLS_NAME_LOSSY;
- upname[i] = exfat_toupper(sb, *uniname);
+ upname[i] = cpu_to_le16(exfat_toupper(sb, *uniname));
uniname++;
}
@@ -614,7 +614,7 @@ static int exfat_nls_to_ucs2(struct supe
struct exfat_uni_name *p_uniname, int *p_lossy)
{
int i = 0, unilen = 0, lossy = NLS_NAME_NO_LOSSY;
- unsigned short upname[MAX_NAME_LENGTH + 1];
+ __le16 upname[MAX_NAME_LENGTH + 1];
unsigned short *uniname = p_uniname->name;
struct nls_table *nls = EXFAT_SB(sb)->nls_io;
@@ -628,7 +628,7 @@ static int exfat_nls_to_ucs2(struct supe
exfat_wstrchr(bad_uni_chars, *uniname))
lossy |= NLS_NAME_LOSSY;
- upname[unilen] = exfat_toupper(sb, *uniname);
+ upname[unilen] = cpu_to_le16(exfat_toupper(sb, *uniname));
uniname++;
unilen++;
}
Powered by blists - more mailing lists