Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp2040076pxt; Sun, 8 Aug 2021 09:27:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyoxA+PEZMLeghwHiKJ5VVm6vUw2mpHWP3ASNM2vvuQmYUBu0zZrdngrqN4krKHJLW7ZNRN X-Received: by 2002:a05:6402:1514:: with SMTP id f20mr24892561edw.336.1628440034164; Sun, 08 Aug 2021 09:27:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628440034; cv=none; d=google.com; s=arc-20160816; b=lCIXRfRWFe0aqZtD/xYcdLyOFGcKC5NCtVxUHkB+diLJGZlbjQ9j/vlLckDshDDYvm cyKHCZoSY0EiALvrrxnTEl/SOg5p4kYg/qUyUzmrYl57GqKnz6HjTbiev0zxECSuFJHS vsygYQN7CDsKSHvnvqU1x9f8x0qPWX73b092xZnD4cGciP2hB6jM6qYyuCg+gY40qstp GffiQp/Cyheu/ofgGzyIQ2KN9rdHuM3VEX+tfUME5owmnm2bXbdCozN++E50aJLVOF94 0yvRiNn7NDV/9QrsLkk4laXmAAeW5Uf8JGzaXvVqKWXO64lD25+m6AZ/TaFwJuSDpJMs uxmQ== 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=9E7CGJPs5mjGrr0K7s2JdB4dyJivsQrZyo1aDTQ44Y8=; b=RjzWwCWZotgUfF7Qom6RB+LTT1SIGnzNxM0zZZWNMmXSePRjC+nigPzJsCgUbCuzfM /NFeIkdFkGrAY7eadHwTDfs1mxqDHBwm9dium9BF+z6rqU9bg65ZjBl7EwVp68Hc2DPu iKCuDjIIDOX8t0M0AMeaIN6FIMNcnW8d/gEMUNByHzfe8W3oxo3nDaSjv59xrBeIe8T6 QN5ur74+slX9Z96ulzyyLhLh6W+uPOloPqr+VFDg2G5S2co3RPZD1Hpk+h7eS3R3OFFP ZRRwNrOzkWAGbLyRSnY7wZ3u2iE6UPL2elrPR/ihYLuxB0QSKyfzhd50a4GrRx5VrJP9 4hrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KVfLZD0Y; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e14si15643861ejj.279.2021.08.08.09.26.51; Sun, 08 Aug 2021 09:27:14 -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=k20201202 header.b=KVfLZD0Y; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232168AbhHHQZm (ORCPT + 99 others); Sun, 8 Aug 2021 12:25:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:47362 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231615AbhHHQZf (ORCPT ); Sun, 8 Aug 2021 12:25:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DD0C961055; Sun, 8 Aug 2021 16:25:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628439916; bh=zCoJxg1h9nD1iTSDYYND3mexw6H7t53eWmn6go64bfs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=KVfLZD0YZScrG/ph5XGKHZLExECypqZLKM1X3Bw6ZrhrZQssU6SEQkjZnYlMvXkaR COtwyTy7mTKO7xBlFz89XRFPDD3/+Gc/NKY/On3DOulLfdnvv4J4ScFRsiYpXhq0lv a1JrO2z7K9QSxZCgxGHHGfpft8Utwx1RcfBoBqKc0OtMRoDyc2i3Xxal88+5ThTkey lh0oX3MYKO47tjOVLtR5wqip+kkYfUu9ymvx4f8TR7H9x5HltpMczA5tuXcaVXTLjv 3XFMnvmwrj3bSfjmXdyLALozpaAwdoYScSgqArTGD5aCFLyTXbzfoPfDqD+3usumC2 j1EVIpi7ZXROw== Received: by pali.im (Postfix) id 99F5713DC; Sun, 8 Aug 2021 18:25:15 +0200 (CEST) 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 , OGAWA Hirofumi , "Theodore Y . Ts'o" , Luis de Bethencourt , Salah Triki , Andrew Morton , Dave Kleikamp , Anton Altaparmakov , Pavel Machek , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Christoph Hellwig Subject: [RFC PATCH 06/20] ntfs: Fix error processing when load_nls() fails Date: Sun, 8 Aug 2021 18:24:39 +0200 Message-Id: <20210808162453.1653-7-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210808162453.1653-1-pali@kernel.org> References: <20210808162453.1653-1-pali@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 02de1aa05b7c..69c7871b742e 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