Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp1914474rwl; Mon, 26 Dec 2022 06:32:56 -0800 (PST) X-Google-Smtp-Source: AMrXdXuOPN3Gd9nHIjLrx/B0/ZGU7+C2fAw0wNKTcwT7kIThHf8i/4G8KN8CSVhgFXiQXpytQCD1 X-Received: by 2002:a50:fd05:0:b0:473:6a8d:945d with SMTP id i5-20020a50fd05000000b004736a8d945dmr15843941eds.4.1672065175922; Mon, 26 Dec 2022 06:32:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672065175; cv=none; d=google.com; s=arc-20160816; b=yRiVxDT5BUqWB3ZO09D8B2mbY3vuPU1bW1wzPkZDK+poJcUNwP4Xq13pS17uV0BT1p rXG7XsWi0KaeleL9uxRM40nZho13Kf+Lgjosac17YY51c3ky1qBtl4ODd7u1PyhhlsK/ T+YrfuUvhkqcO8iSSkuG5FmSCkL42Re9IbgE3u+KRk/720cfMQEFhqvhmIqNZxv6gdaj JNx9l208Z5PrfIlbcqhR3qTRMFtCJQNDcL20dtsh/ewHExt0ZM4GV1aiJ+xLjOZdqxpR J7qpqnu7TQpzv4GfhqcQ75/oV5rmCDYzKjpA8so8wTYEzc/+DycTvAeTrMKzSwLdFpyO 5LfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Gd1qQSioLg92DUimnR82AShrP0C1CTLKjwh7IQOpFqc=; b=M0JwIgCIw/dR7PCulA/qyr96Qhzk9hYsSCAhz0VI4l8CRPRqjbhYMZkxEDeopUjNpp vHyZGGiMQ+FpLWbO1ktflCtxQy4Bw5wDqKCqnA9Ltkmtdpmtf7SXNky/FPbV1dHx+E/O x1UAbxv1z8a5tmIEBd+vW3sSo6gKKfGAAWYwfnQ9hjDf6CD8oW2pwVQR8V/l6Q06hD2O Jrl7WFMbaNpdyaM90C3igT6ZXwMZN9hbEjA1JrJqvd1XqE0fENshgb77xhfhXeD1KQL+ Q5GYu9nL/LQzhnvngADUAVEbS01QKZEUzxnf+PVJ/feZlnJvfvPO4n+l9eAHojklgLml 1pdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=E4k5OXvy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v12-20020a056402348c00b004639a46d725si10074766edc.31.2022.12.26.06.32.36; Mon, 26 Dec 2022 06:32:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=E4k5OXvy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230520AbiLZOWT (ORCPT + 67 others); Mon, 26 Dec 2022 09:22:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231614AbiLZOWG (ORCPT ); Mon, 26 Dec 2022 09:22:06 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F6B91140; Mon, 26 Dec 2022 06:22:06 -0800 (PST) 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 E0F4560EB4; Mon, 26 Dec 2022 14:22:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F842C433D2; Mon, 26 Dec 2022 14:22:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672064525; bh=22S317lWg8AbLm/4T86Rzeza0QVf8ZdO+6YLdtwviT0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=E4k5OXvypcw8JKWNx6C4dSUgCG2CsGTlxUbLraGkrXVSvF8AMAD7gX7KnyZDbc3uX ZsNzjvKiPxDxG+oR5TopbMGilH1sUH3bokqsnBHlqzkz4AQKh7/B9WXFNeej/reQya dU1Mnq6X+mGX9sykpmVkUki7ScBWs84ONjlv1qoJm0t7e79xu6cZNjMWpFMdd3vkwz UjJRhFH5fv+TqT8wdZI5Tw/E6K/zVf0vNVX4NLda6wj+29s3ruxs9Tya/z86tEjBE+ rwVylYF+UiX3jen7J7X3chKLADzrU7lT2hxuBJSNwCHwCwa6bpWJSQgoDQpm+LrrLt Mb4naxRegkZ+g== Received: by pali.im (Postfix) id DED229D7; Mon, 26 Dec 2022 15:22:04 +0100 (CET) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: linux-fsdevel@vger.kernel.org, linux-ntfs-dev@lists.sourceforge.net, linux-cifs@vger.kernel.org, jfs-discussion@lists.sourceforge.net, linux-kernel@vger.kernel.org, Alexander Viro , Jan Kara , "Theodore Y . Ts'o" , Anton Altaparmakov , OGAWA Hirofumi , Luis de Bethencourt , Salah Triki , Steve French , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , Dave Kleikamp , Andrew Morton , Pavel Machek , Christoph Hellwig , Kari Argillander , Viacheslav Dubeyko Subject: [RFC PATCH v2 04/18] ntfs: Fix error processing when load_nls() fails Date: Mon, 26 Dec 2022 15:21:36 +0100 Message-Id: <20221226142150.13324-5-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20221226142150.13324-1-pali@kernel.org> References: <20221226142150.13324-1-pali@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Ensure that specified charset in iocharset= mount option is used. On error correctly propagate error code back to the caller. Signed-off-by: Pali Rohár --- fs/ntfs/super.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c index 55762abdc22a..b4f26035e750 100644 --- a/fs/ntfs/super.c +++ b/fs/ntfs/super.c @@ -94,7 +94,7 @@ static bool parse_options(ntfs_volume *vol, char *opt) umode_t fmask = (umode_t)-1, dmask = (umode_t)-1; int mft_zone_multiplier = -1, on_errors = -1; int show_sys_files = -1, case_sensitive = -1, disable_sparse = -1; - struct nls_table *nls_map = NULL, *old_nls; + struct nls_table *nls_map = NULL; /* I am lazy... (-8 */ #define NTFS_GETOPT_WITH_DEFAULT(option, variable, default_value) \ @@ -195,20 +195,12 @@ static bool parse_options(ntfs_volume *vol, char *opt) if (!v || !*v) goto needs_arg; use_utf8: - old_nls = nls_map; + unload_nls(nls_map); nls_map = load_nls(v); if (!nls_map) { - if (!old_nls) { - ntfs_error(vol->sb, "NLS character set " - "%s not found.", v); - return false; - } - ntfs_error(vol->sb, "NLS character set %s not " - "found. Using previous one %s.", - v, old_nls->charset); - nls_map = old_nls; - } else /* nls_map */ { - unload_nls(old_nls); + ntfs_error(vol->sb, "NLS character set " + "%s not found.", v); + return false; } } else if (!strcmp(p, "utf8")) { bool val = false; -- 2.20.1