linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* ext4: fix memory leak in xattr code.
@ 2013-09-20 14:29 Dave Jones
  2013-09-20 15:29 ` Eric Sandeen
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Jones @ 2013-09-20 14:29 UTC (permalink / raw)
  To: tytso; +Cc: Andreas Dilger, linux-ext4, linux-kernel

If we take the 2nd retry path in ext4_expand_extra_isize_ea, we potentionally
return from the function without having freed these allocations.
If we don't do the return, we over-write the previous allocation pointers, 
so we leak either way.

Spotted with Coverity.

Signed-off-by: Dave Jones <davej@fedoraproject.org>

diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index c081e34..f3a6220 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -1350,6 +1350,8 @@ retry:
 				    s_min_extra_isize) {
 					tried_min_extra_isize++;
 					new_extra_isize = s_min_extra_isize;
+					kfree(is);
+					kfree(bs);
 					goto retry;
 				}
 				error = -1;

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

end of thread, other threads:[~2013-09-22 19:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-20 14:29 ext4: fix memory leak in xattr code Dave Jones
2013-09-20 15:29 ` Eric Sandeen
2013-09-22 19:33   ` 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).