From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD6EF611B for ; Sun, 28 May 2023 19:37:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4AF6EC433D2; Sun, 28 May 2023 19:37:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1685302675; bh=guxoDaOfg2nxB76Uq6kbYWKFXDOU2gubYzDBYTEQPYI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zPBPnlQVX9jSsZz+rkhXXwflALKNsdBl4seicz5rUYIp+hlhodlj0OZTdLXFx4Hnr XxMW6akkqfLUicG/Lfh9xM+GsZ01z0gwokYFje0FbPZ9s4ZdWFCC3mqaU/SLZX67KR OYUyiPNSNp19IDrrmzwkgyENGebH3Gh+Sbw984zc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Tyler Spivey , Steve French Subject: [PATCH 6.1 072/119] cifs: mapchars mount option ignored Date: Sun, 28 May 2023 20:11:12 +0100 Message-Id: <20230528190837.911411359@linuxfoundation.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230528190835.386670951@linuxfoundation.org> References: <20230528190835.386670951@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Steve French commit cb8b02fd6343228966324528adf920bfb8b8e681 upstream. There are two ways that special characters (not allowed in some other operating systems like Windows, but allowed in POSIX) have been mapped in the past ("SFU" and "SFM" mappings) to allow them to be stored in a range reserved for special chars. The default for Linux has been to use "mapposix" (ie the SFM mapping) but the conversion to the new mount API in the 5.11 kernel broke the ability to override the default mapping of the reserved characters (like '?' and '*' and '\') via "mapchars" mount option. This patch fixes that - so can now mount with "mapchars" mount option to override the default ("mapposix" ie SFM) mapping. Reported-by: Tyler Spivey Fixes: 24e0a1eff9e2 ("cifs: switch to new mount api") Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/cifs/fs_context.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/fs/cifs/fs_context.c +++ b/fs/cifs/fs_context.c @@ -904,6 +904,14 @@ static int smb3_fs_context_parse_param(s ctx->sfu_remap = false; /* disable SFU mapping */ } break; + case Opt_mapchars: + if (result.negated) + ctx->sfu_remap = false; + else { + ctx->sfu_remap = true; + ctx->remap = false; /* disable SFM (mapposix) mapping */ + } + break; case Opt_user_xattr: if (result.negated) ctx->no_xattr = 1;