From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD6D2C77B7E for ; Sun, 28 May 2023 19:50:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231422AbjE1Tu2 (ORCPT ); Sun, 28 May 2023 15:50:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231416AbjE1Tu1 (ORCPT ); Sun, 28 May 2023 15:50:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 725D39C for ; Sun, 28 May 2023 12:50:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1011562054 for ; Sun, 28 May 2023 19:50:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2CCA3C433D2; Sun, 28 May 2023 19:50:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1685303425; bh=uyvgc5IBlqbpLkRDLg12ZWWMsmOVAwK+JnJsQncTa1U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wD1wkIp9D39fqdG7WyjK7vn15LTDki+3blpCKj4YNokzkOHdrKc/ogHQYGTnVoJTO 2MNfCbxG+TKMKYKbIUo3OuvmSTyZsOc9SjSxBR/pnMOEDizJ1xIb5MlqxsjKXDxup2 kK3xz1hc4PGip3zIHcDSvaq9/uxlBBKpEgmlHZfE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Tyler Spivey , Steve French Subject: [PATCH 5.15 41/69] cifs: mapchars mount option ignored Date: Sun, 28 May 2023 20:12:01 +0100 Message-Id: <20230528190829.901355456@linuxfoundation.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230528190828.358612414@linuxfoundation.org> References: <20230528190828.358612414@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 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 @@ -884,6 +884,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;