Received: by 2002:a17:90b:8d0:0:0:0:0 with SMTP id ds16csp4884139pjb; Mon, 27 Jul 2020 07:33:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKv0Z970FgBl5n+txpBklg6m7YWTTGXXbCGFuP5VNy6GZ8fmTzSEYot3gJzqk6plgqTQlV X-Received: by 2002:a17:907:11db:: with SMTP id va27mr22339259ejb.175.1595860411067; Mon, 27 Jul 2020 07:33:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595860411; cv=none; d=google.com; s=arc-20160816; b=m8D0onSEXLfC21+Cu3Z8pKAzksAobmnTaVJn7avdEd1+KRXA4n4l/HW6HRb/8XiF5+ H+iJUJSy5U2iR7T7VNm5/oWf/CpWLdLRSaO8SW5mGGzAo9Y+jPYxzA3rxaok/rGpRwDc lJ1LaEd7A73CdN+Bk2sfGwwemYmKBfSc2XHpUu1JWBIUmEA4XYf0qM7pQtxWe1ue79dk xvWvCUGklr+eWNEEMdSfodDywGT7yAU06WYCgkFiR4cHO+kVjLo+WoICnUSq8pi4vbsK Si71mq0Fcivz5CWeSIPWo8sLqP67U37obdX2vvhEYvbI51XwJlqHHBg19/VXXL8/biK8 P1eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=C3Xsol9EpJMvyeBg2K0D/+Kg9B+a8wFYzG7qZpnRmDs=; b=EyMo85FcU3zh1yB4Lw+g2n54C+Mu05EYPhbAE7//5xk/b3ke9PYVWWJH/OloAc6FQk JwNVmQx+6JG3MvOIgzOkqporye35xgAV/SvclThObW9c1Omr5WAfErZ+w6EqP1m+ca5S 5rHLL+nINlvj49arG5enhmc4UF6X7wXcowXyMZHrFKtw/A4FkBfFowcbQhrMTh0oy0sf mY40402nF3f/XkCDqRZpfgeUkotQp0H5REGpIZ7zwv1iUJ7nFh0HuvJOmJyflh7WaNjZ zf7tAqnrkyqyFSb8Gsq3vPH55uwVYjuSaCUjEwrjhmwzePy9qPjlyCIkRqN2GzFWRwVY cTEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QP6VQdqv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n2si5665152edt.572.2020.07.27.07.33.08; Mon, 27 Jul 2020 07:33:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QP6VQdqv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731456AbgG0OTx (ORCPT + 99 others); Mon, 27 Jul 2020 10:19:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:47926 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731445AbgG0OTu (ORCPT ); Mon, 27 Jul 2020 10:19:50 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 824F32075A; Mon, 27 Jul 2020 14:19:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595859590; bh=FrXkJIjIfPxFCaet73fYO+GvqQejZFZxu7LwH5m4W6s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QP6VQdqvzItpFCfZyRlNWp+LKQcsWAfJBHCjcWXC/YTuJMvx9XaWbP1s58lILZgcA fgmWYR5nbCkk0vImnk9BcAsIDshNXj7DvWfQGSp3ZTCS9FXxtv5kGJVEDDYJcq1HDc ZbZTFK5lyGVnGjpAbqRYzeXbsCJm107W1Ys/Ovg0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen Minqiang , Ilya Ponetayev , Sungjong Seo , Namjae Jeon Subject: [PATCH 5.7 030/179] exfat: fix name_hash computation on big endian systems Date: Mon, 27 Jul 2020 16:03:25 +0200 Message-Id: <20200727134934.132666901@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200727134932.659499757@linuxfoundation.org> References: <20200727134932.659499757@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ilya Ponetayev 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@vger.kernel.org # v5.7 Signed-off-by: Chen Minqiang Signed-off-by: Ilya Ponetayev Reviewed-by: Sungjong Seo Signed-off-by: Namjae Jeon Signed-off-by: Greg Kroah-Hartman --- 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++; }