[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200930065813.GC11648@pengutronix.de>
Date: Wed, 30 Sep 2020 08:58:13 +0200
From: Sascha Hauer <s.hauer@...gutronix.de>
To: Zhihao Cheng <chengzhihao1@...wei.com>
Cc: richard@....at, yi.zhang@...wei.com, linux-mtd@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/3] ubifs: Don't parse authentication mount options in
remount process
On Tue, Sep 29, 2020 at 08:45:30PM +0800, Zhihao Cheng wrote:
> 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@...wei.com>
> Cc: <stable@...r.kernel.org> # 4.20+
> Fixes: d8a22773a12c6d7 ("ubifs: Enable authentication support")
Reviewed-by: Sascha Hauer <s.hauer@...gutronix.de>
Sascha
> ---
> fs/ubifs/super.c | 18 ++++++++++++------
> 1 file changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
> index 6f85cd618766..9796f5df2f7f 100644
> --- a/fs/ubifs/super.c
> +++ b/fs/ubifs/super.c
> @@ -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;
> --
> 2.25.4
>
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Powered by blists - more mailing lists