[JFFS2] Fix potential memory leak of dead xattrs on unmount.

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon May 21 11:59:01 EDT 2007


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=2ad8ee713566671875216ebcec64f2eda47bd19d
Commit:     2ad8ee713566671875216ebcec64f2eda47bd19d
Parent:     8ae5d31263c746f1680d005b33a82d167cdb9eb6
Author:     David Woodhouse <dwmw2 at infradead.org>
AuthorDate: Tue May 8 00:12:58 2007 +0100
Committer:  David Woodhouse <dwmw2 at infradead.org>
CommitDate: Sun May 20 11:30:38 2007 -0400

    [JFFS2] Fix potential memory leak of dead xattrs on unmount.
    
    An xattr_datum which ends up orphaned should be freed by the GC
    thread. But if we umount before the GC thread is finished, or if we
    mount read-only and the GC thread never runs, they might never be
    freed. Clean them up during unmount, if there are any left.
    
    Signed-off-by: David Woodhouse <dwmw2 at infradead.org>
---
 fs/jffs2/xattr.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/fs/jffs2/xattr.c b/fs/jffs2/xattr.c
index 0734698..e486659 100644
--- a/fs/jffs2/xattr.c
+++ b/fs/jffs2/xattr.c
@@ -754,6 +754,10 @@ void jffs2_clear_xattr_subsystem(struct jffs2_sb_info *c)
 		list_del(&xd->xindex);
 		jffs2_free_xattr_datum(xd);
 	}
+	list_for_each_entry_safe(xd, _xd, &c->xattr_unchecked, xindex) {
+		list_del(&xd->xindex);
+		jffs2_free_xattr_datum(xd);
+	}
 }
 
 #define XREF_TMPHASH_SIZE	(128)



More information about the linux-mtd-cvs mailing list