Thread (49 messages) 49 messages, 6 authors, 2022-09-25
STALE1344d
Revisions (2)
  1. rfc current
  2. v2 [diff vs current]

[RFC PATCH 06/20] ntfs: Fix error processing when load_nls() fails

From: Pali Rohár <pali@kernel.org>
Date: 2021-08-08 16:25:50
Also in: linux-fsdevel, lkml
Subsystem: filesystems (vfs and infrastructure), ntfs filesystem, the rest · Maintainers: Alexander Viro, Christian Brauner, Namjae Jeon, Hyunchul Lee, Linus Torvalds

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 <pali@kernel.org>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help