Skip to content

Commit

Permalink
ubifs: Don't parse authentication mount options in remount process
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Zhihao Cheng authored and richardweinberger committed Oct 11, 2020
1 parent 47f6d9c commit bb674a4
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions fs/ubifs/super.c
Expand Up @@ -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;
Expand Down

0 comments on commit bb674a4

Please sign in to comment.