Kernel memleak in jffs2_erase_block() (fs/jffs2/erase.c:78)

Damir Shayhutdinov lost404 at gmail.com
Mon Nov 12 05:39:02 EST 2007


Hi!

I'm studying JFFS2 code now, and I believe I've found a kernel memory leak.

fs/jffs2/erase.c:

76         ret = c->mtd->erase(c->mtd, instr);
77         if (!ret)
78                 return;

In case of ret == 0 (erase succeeded), line 78 leaves the function
jffs2_erase_block without kfree-ing previously kmalloc-ed pointer
instr (line 50).

So, sizeof(struct erase_info) + sizeof(struct erase_priv_struct) bytes
are leaking each time block is erased successfully.



More information about the linux-mtd mailing list