]> Git Repo - J-linux.git/commitdiff
ubifs: Don't parse authentication mount options in remount process
authorZhihao Cheng <[email protected]>
Tue, 29 Sep 2020 12:45:30 +0000 (20:45 +0800)
committerRichard Weinberger <[email protected]>
Sun, 11 Oct 2020 20:05:49 +0000 (22:05 +0200)
There is no need to dump authentication options while remounting,
because authentication initialization can only be doing once in
the first mount process. Dumping authentication mount options in
remount process may cause memory leak if UBIFS has already been
mounted with old authentication mount options.

Signed-off-by: Zhihao Cheng <[email protected]>
Cc: <[email protected]> # 4.20+
Fixes: d8a22773a12c6d7 ("ubifs: Enable authentication support")
Reviewed-by: Sascha Hauer <[email protected]>
Signed-off-by: Richard Weinberger <[email protected]>
fs/ubifs/super.c

index 6f85cd6187662332fd884e14b03270588b30e12f..9796f5df2f7ff560c6a72966f07aa962b81e1fd3 100644 (file)
@@ -1110,14 +1110,20 @@ static int ubifs_parse_options(struct ubifs_info *c, char *options,
                        break;
                }
                case Opt_auth_key:
-                       c->auth_key_name = kstrdup(args[0].from, GFP_KERNEL);
-                       if (!c->auth_key_name)
-                               return -ENOMEM;
+                       if (!is_remount) {
+                               c->auth_key_name = kstrdup(args[0].from,
+                                                               GFP_KERNEL);
+                               if (!c->auth_key_name)
+                                       return -ENOMEM;
+                       }
                        break;
                case Opt_auth_hash_name:
-                       c->auth_hash_name = kstrdup(args[0].from, GFP_KERNEL);
-                       if (!c->auth_hash_name)
-                               return -ENOMEM;
+                       if (!is_remount) {
+                               c->auth_hash_name = kstrdup(args[0].from,
+                                                               GFP_KERNEL);
+                               if (!c->auth_hash_name)
+                                       return -ENOMEM;
+                       }
                        break;
                case Opt_ignore:
                        break;
This page took 0.047455 seconds and 4 git commands to generate.