summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChengguang Xu2018-05-22 06:24:25 +0200
committerDavid Sterba2018-05-28 12:36:41 +0200
commit84ae6f829fc2b23dd4985ab059cddfd4a1ccc14f (patch)
tree24b09f9e02ad881459cd15cc891a2ad6c2c4043c
parentMerge branch 'stable/for-linus-4.17' of git://git.kernel.org/pub/scm/linux/ke... (diff)
downloadkernel-qcow2-linux-84ae6f829fc2b23dd4985ab059cddfd4a1ccc14f.tar.gz
kernel-qcow2-linux-84ae6f829fc2b23dd4985ab059cddfd4a1ccc14f.tar.xz
kernel-qcow2-linux-84ae6f829fc2b23dd4985ab059cddfd4a1ccc14f.zip
affs: fix potential memory leak when parsing option 'prefix'
When specifying option 'prefix' multiple times, current option parsing will cause memory leak. Hence, call kfree for previous one in this case. Signed-off-by: Chengguang Xu <cgxu519@gmx.com> Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--fs/affs/super.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/affs/super.c b/fs/affs/super.c
index e602619aed9d..d1ad11a8a4a5 100644
--- a/fs/affs/super.c
+++ b/fs/affs/super.c
@@ -241,6 +241,7 @@ parse_options(char *options, kuid_t *uid, kgid_t *gid, int *mode, int *reserved,
affs_set_opt(*mount_opts, SF_NO_TRUNCATE);
break;
case Opt_prefix:
+ kfree(*prefix);
*prefix = match_strdup(&args[0]);
if (!*prefix)
return 0;