summaryrefslogtreecommitdiffstats
path: root/fs/ubifs
diff options
context:
space:
mode:
authorWenwen Wang <wenwen@cs.uga.edu>2019-08-19 23:44:24 -0500
committerRichard Weinberger <richard@nod.at>2019-09-15 22:12:20 +0200
commit9163e0184bd7d5f779934d34581843f699ad2ffd (patch)
tree7d3908f114eb453aa03338a59731e7041acd728d /fs/ubifs
parent7992e00469c485f108a7f0da08be34b0fa441f79 (diff)
downloadlinux-9163e0184bd7d5f779934d34581843f699ad2ffd.tar.bz2
ubifs: Fix memory leak bug in alloc_ubifs_info() error path
In ubifs_mount(), 'c' is allocated through kzalloc() in alloc_ubifs_info(). However, it is not deallocated in the following execution if ubifs_fill_super() fails, leading to a memory leak bug. To fix this issue, free 'c' before going to the 'out_deact' label. Fixes: 1e51764a3c2a ("UBIFS: add new flash file system") Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu> Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'fs/ubifs')
-rw-r--r--fs/ubifs/super.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 8c1d571334bc..fe9231fc4702 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -2256,8 +2256,10 @@ static struct dentry *ubifs_mount(struct file_system_type *fs_type, int flags,
}
} else {
err = ubifs_fill_super(sb, data, flags & SB_SILENT ? 1 : 0);
- if (err)
+ if (err) {
+ kfree(c);
goto out_deact;
+ }
/* We do not support atime */
sb->s_flags |= SB_ACTIVE;
if (IS_ENABLED(CONFIG_UBIFS_ATIME_SUPPORT))