Skip to content

Commit bb674a4

Browse files
Zhihao Chengrichardweinberger
authored andcommitted
ubifs: Don't parse authentication mount options in remount process
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: d8a2277 ("ubifs: Enable authentication support") Reviewed-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Richard Weinberger <richard@nod.at>
1 parent 47f6d9c commit bb674a4

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

fs/ubifs/super.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,14 +1110,20 @@ static int ubifs_parse_options(struct ubifs_info *c, char *options,
11101110
break;
11111111
}
11121112
case Opt_auth_key:
1113-
c->auth_key_name = kstrdup(args[0].from, GFP_KERNEL);
1114-
if (!c->auth_key_name)
1115-
return -ENOMEM;
1113+
if (!is_remount) {
1114+
c->auth_key_name = kstrdup(args[0].from,
1115+
GFP_KERNEL);
1116+
if (!c->auth_key_name)
1117+
return -ENOMEM;
1118+
}
11161119
break;
11171120
case Opt_auth_hash_name:
1118-
c->auth_hash_name = kstrdup(args[0].from, GFP_KERNEL);
1119-
if (!c->auth_hash_name)
1120-
return -ENOMEM;
1121+
if (!is_remount) {
1122+
c->auth_hash_name = kstrdup(args[0].from,
1123+
GFP_KERNEL);
1124+
if (!c->auth_hash_name)
1125+
return -ENOMEM;
1126+
}
11211127
break;
11221128
case Opt_ignore:
11231129
break;

0 commit comments

Comments
 (0)