]> rtime.felk.cvut.cz Git - linux-imx.git/commitdiff
UBIFS: fix memory leak on error path
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Tue, 31 May 2011 05:40:40 +0000 (08:40 +0300)
committerAndi Kleen <ak@linux.intel.com>
Mon, 1 Aug 2011 20:54:54 +0000 (13:54 -0700)
commit 812eb258311f89bcd664a34a620f249d54a2cd83 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
fs/ubifs/journal.c

index d321baeca68db65cb0bcce2fcd38ead5ee4e2e65..841f77cc93cfdec2e826af39b56755df31614ece 100644 (file)
@@ -665,6 +665,7 @@ out_free:
 
 out_release:
        release_head(c, BASEHD);
+       kfree(dent);
 out_ro:
        ubifs_ro_mode(c, err);
        if (last_reference)