linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext4: fix possible memory leak in ext4_remount()
@ 2013-02-27  5:18 Wei Yongjun
  2013-02-27 12:45 ` Lukáš Czerner
  2013-03-02 22:13 ` Theodore Ts'o
  0 siblings, 2 replies; 3+ messages in thread
From: Wei Yongjun @ 2013-02-27  5:18 UTC (permalink / raw)
  To: tytso, adilger.kernel; +Cc: yongjun_wei, linux-ext4

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

'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: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 fs/ext4/super.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 373d46c..8ae09e3 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -4538,6 +4538,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
 			if (!old_opts.s_qf_names[i]) {
 				for (j = 0; j < i; j++)
 					kfree(old_opts.s_qf_names[j]);
+				kfree(orig_data);
 				return -ENOMEM;
 			}
 		} else



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-03-02 22:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-27  5:18 [PATCH] ext4: fix possible memory leak in ext4_remount() Wei Yongjun
2013-02-27 12:45 ` Lukáš Czerner
2013-03-02 22:13 ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).