[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191002215242.14317-1-navid.emamdoost@gmail.com>
Date: Wed, 2 Oct 2019 16:52:37 -0500
From: Navid Emamdoost <navid.emamdoost@...il.com>
To: dsterba@...e.cz
Cc: emamd001@....edu, smccaman@....edu, kjlu@....edu,
Navid Emamdoost <navid.emamdoost@...il.com>,
David Sterba <dsterba@...e.com>,
Jeff Layton <jlayton@...nel.org>,
Kees Cook <keescook@...omium.org>,
Deepa Dinamani <deepa.kernel@...il.com>,
"Gustavo A. R. Silva" <gustavo@...eddedor.com>,
Thomas Gleixner <tglx@...utronix.de>,
Al Viro <viro@...iv.linux.org.uk>,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH v3] fs: affs: fix a memory leak in affs_remount
In affs_remount if data is provided it is duplicated into new_opts.
The allocated memory for new_opts is only released if pare_options fail.
But the variable is not used anywhere. So the new_opts should be
removed.
Fixes: c8f33d0bec99 ("affs: kstrdup() memory handling")
Signed-off-by: Navid Emamdoost <navid.emamdoost@...il.com>
---
Changes in v2:
-- fix typo
Changes in v3:
-- remove the call to kstrdup, as new_opts is not used anymore.
---
fs/affs/super.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/fs/affs/super.c b/fs/affs/super.c
index cc463ae47c12..b6c6080d186c 100644
--- a/fs/affs/super.c
+++ b/fs/affs/super.c
@@ -565,10 +565,6 @@ affs_remount(struct super_block *sb, int *flags, char *data)
char volume[32];
char *prefix = NULL;
- new_opts = kstrdup(data, GFP_KERNEL);
- if (data && !new_opts)
- return -ENOMEM;
-
pr_debug("%s(flags=0x%x,opts=\"%s\")\n", __func__, *flags, data);
sync_filesystem(sb);
@@ -579,7 +575,6 @@ affs_remount(struct super_block *sb, int *flags, char *data)
&blocksize, &prefix, volume,
&mount_flags)) {
kfree(prefix);
- kfree(new_opts);
return -EINVAL;
}
--
2.17.1
Powered by blists - more mailing lists