Patchwork [1/1] jffs2: leaking jffs2_summary in function jffs2_scan_medium

login
register
mail settings
Submitter Christian Engelmayer
Date June 13, 2009, 9:06 p.m.
Message ID <20090613230629.2a0bc935@frequentis.com>
Download mbox | patch
Permalink /patch/28679/
State New, archived
Headers show

Comments

Christian Engelmayer - June 13, 2009, 9:06 p.m.
From: Christian Engelmayer <christian.engelmayer@frequentis.com>

In case of an error returned by file_dirty() 's' is not freed as the cleanup
path is skipped.

Signed-off-by: Christian Engelmayer <christian.engelmayer@frequentis.com>
--
Reported by Coverity.

Patch

--- linux-2.6.29.4/fs/jffs2/scan.c.orig	2009-06-13 22:49:07.000000000 +0200
+++ linux-2.6.29.4/fs/jffs2/scan.c	2009-06-13 22:29:06.000000000 +0200
@@ -196,7 +196,7 @@  int jffs2_scan_medium(struct jffs2_sb_in
 				if (c->nextblock) {
 					ret = file_dirty(c, c->nextblock);
 					if (ret)
-						return ret;
+						goto out;
 					/* deleting summary information of the old nextblock */
 					jffs2_sum_reset_collected(c->summary);
 				}
@@ -207,7 +207,7 @@  int jffs2_scan_medium(struct jffs2_sb_in
 			} else {
 				ret = file_dirty(c, jeb);
 				if (ret)
-					return ret;
+					goto out;
 			}
 			break;