diff options
author | Chengguang Xu <cgxu519@gmx.com> | 2018-06-13 12:05:13 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-11-27 16:13:00 +0100 |
commit | 33df917736f090740e8050d19437e5029be29d00 (patch) | |
tree | 3d8c3e14303d9b7867d2cd991467c2a8d0dc7aa3 /fs/exofs | |
parent | b7d1a7868cebb8cde5fe09ba41d44f8b04c990e2 (diff) | |
download | linux-stable-33df917736f090740e8050d19437e5029be29d00.tar.gz linux-stable-33df917736f090740e8050d19437e5029be29d00.tar.bz2 linux-stable-33df917736f090740e8050d19437e5029be29d00.zip |
fs/exofs: fix potential memory leak in mount option parsing
[ Upstream commit 515f1867addaba49c1c6ac73abfaffbc192c1db4 ]
There are some cases can cause memory leak when parsing
option 'osdname'.
Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs/exofs')
-rw-r--r-- | fs/exofs/super.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/exofs/super.c b/fs/exofs/super.c index 41cf2fbee50d..7d61e3fa378c 100644 --- a/fs/exofs/super.c +++ b/fs/exofs/super.c @@ -101,6 +101,7 @@ static int parse_options(char *options, struct exofs_mountopt *opts) token = match_token(p, tokens, args); switch (token) { case Opt_name: + kfree(opts->dev_name); opts->dev_name = match_strdup(&args[0]); if (unlikely(!opts->dev_name)) { EXOFS_ERR("Error allocating dev_name"); @@ -866,8 +867,10 @@ static struct dentry *exofs_mount(struct file_system_type *type, int ret; ret = parse_options(data, &opts); - if (ret) + if (ret) { + kfree(opts.dev_name); return ERR_PTR(ret); + } if (!opts.dev_name) opts.dev_name = dev_name; |