]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[JFFS2] Fix potential memory leak of dead xattrs on unmount.
authorDavid Woodhouse <dwmw2@infradead.org>
Mon, 7 May 2007 23:12:58 +0000 (00:12 +0100)
committerDavid Woodhouse <dwmw2@infradead.org>
Sun, 20 May 2007 15:30:38 +0000 (11:30 -0400)
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@infradead.org>
fs/jffs2/xattr.c

index 073469856d4e0b3c3ed3619d002cfe4cdb0140c2..e48665984cb3393d1f859e27db42ba29a6937345 100644 (file)
@@ -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)