public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* JFFS2 bugfix
@ 2004-10-16 17:14 Artem B. Bityuckiy
  2004-10-18 11:57 ` Ferenc Havasi
  0 siblings, 1 reply; 19+ messages in thread
From: Artem B. Bityuckiy @ 2004-10-16 17:14 UTC (permalink / raw)
  To: linux-mtd

Hello,

I've found bug in JFFS2. When there is no free space left on JFFS2 file 
system, and somebody for example tries to creade new directory, JFFS2 
frees memory twice.

See dir.c, jffs2_create(), line 216.

jffs2_do_create returns error.
jffs2_clear_inode(inode) is called and frees the jffs2_sb_info, 
jffs2_full_dnode, etc.
iput(inode) is called, calling in turn the jffs2_clear_inode, and the 
same structures are freed for the second time. This leads to the slab 
cache corruption.

So, the following patch which fixes the problem is proposed.

--- dir.c       2004-10-16 21:02:22.886276648 +0400
+++ dir_corrected.c     2004-10-16 21:03:10.843766654 +0400
@@ -217,7 +217,6 @@
                               dentry->d_name.name, dentry->d_name.len);

         if (ret) {
-               jffs2_clear_inode(inode);
                 make_bad_inode(inode);
                 iput(inode);
                 jffs2_free_raw_inode(ri);

-- 
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2004-10-20 12:06 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-16 17:14 JFFS2 bugfix Artem B. Bityuckiy
2004-10-18 11:57 ` Ferenc Havasi
2004-10-18 12:16   ` Artem B. Bityuckiy
2004-10-19  7:57     ` Ferenc Havasi
2004-10-19  8:06       ` Artem B. Bityuckiy
2004-10-19  9:16       ` David Woodhouse
     [not found]       ` <4174D508.8050508@yandex.ru>
2004-10-19 10:09         ` JFFS2 compression Ferenc Havasi
2004-10-19 10:14           ` David Woodhouse
2004-10-20  9:16             ` Ferenc Havasi
2004-10-20  9:16               ` David Woodhouse
2004-10-20 11:13               ` Artem B. Bityuckiy
2004-10-20 11:53                 ` Ferenc Havasi
2004-10-20 12:06                   ` Artem B. Bityuckiy
2004-10-19 10:48           ` Artem B. Bityuckiy
2004-10-19 12:06             ` Ferenc Havasi
2004-10-19 12:19               ` Artem B. Bityuckiy
2004-10-19 13:43                 ` David Woodhouse
2004-10-19 14:07                   ` Ferenc Havasi
2004-10-19 14:08                     ` David Woodhouse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox