Commit 3e36a163 authored by Wei Yongjun's avatar Wei Yongjun Committed by Theodore Ts'o

ext4: fix possible memory leak in ext4_remount()

'orig_data' is malloced in ext4_remount() and should be freed
before leaving from the error handling cases, otherwise it will
cause memory leak.
Signed-off-by: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: default avatarLukas Czerner <lczerner@redhat.com>
Cc: stable@vger.kernel.org
parent df05c1b8
...@@ -4543,6 +4543,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) ...@@ -4543,6 +4543,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
if (!old_opts.s_qf_names[i]) { if (!old_opts.s_qf_names[i]) {
for (j = 0; j < i; j++) for (j = 0; j < i; j++)
kfree(old_opts.s_qf_names[j]); kfree(old_opts.s_qf_names[j]);
kfree(orig_data);
return -ENOMEM; return -ENOMEM;
} }
} else } else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment