summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorZhihao Cheng <chengzhihao1@huawei.com>2020-09-29 20:45:30 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-11-05 11:43:32 +0100
commit9ba6324ca9c4a1f4fc24c3620ae41fc10239a4cf (patch)
tree2cdfe829772b815ad4572b7bc30568cf09d97a5c /fs
parent748057df47b90b338ec60ec784ae7f3c9161094a (diff)
ubifs: Don't parse authentication mount options in remount process
commit bb674a4d4de1032837fcbf860a63939e66f0b7ad upstream. 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 <chengzhihao1@huawei.com> Cc: <stable@vger.kernel.org> # 4.20+ Fixes: d8a22773a12c6d7 ("ubifs: Enable authentication support") Reviewed-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/ubifs/super.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 05ce40ee7d64..94ddb0ff1ad7 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -1092,14 +1092,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;