Patchwork [06/10] UBIFS: fix memory leak on error path

login
register
mail settings
Submitter Artem Bityutskiy
Date June 3, 2011, 1:49 p.m.
Message ID <1307109001-19761-7-git-send-email-dedekind1@gmail.com>
Download mbox | patch
Permalink /patch/98574/
State Accepted
Commit 812eb258311f89bcd664a34a620f249d54a2cd83
Headers show

Comments

Artem Bityutskiy - June 3, 2011, 1:49 p.m.
From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>

UBIFS leaks memory on error path in 'ubifs_jnl_update()' in case of write
failure because it forgets to free the 'struct ubifs_dent_node *dent' object.
Although the object is small, the alignment can make it large - e.g., 2KiB
if the min. I/O unit is 2KiB.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: stable@kernel.org
---
 fs/ubifs/journal.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Patch

diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c
index 34b1679..cef0460 100644
--- a/fs/ubifs/journal.c
+++ b/fs/ubifs/journal.c
@@ -669,6 +669,7 @@  out_free:
 
 out_release:
 	release_head(c, BASEHD);
+	kfree(dent);
 out_ro:
 	ubifs_ro_mode(c, err);
 	if (last_reference)