]> git.neil.brown.name Git - history.git/commit
[PATCH] Fix bugs in ext2_new_inode()
authorAndrew Morton <akpm@osdl.org>
Tue, 18 Nov 2003 16:15:17 +0000 (08:15 -0800)
committerLinus Torvalds <torvalds@home.osdl.org>
Tue, 18 Nov 2003 16:15:17 +0000 (08:15 -0800)
commit0fa7a1a91374d738a27d84f022807f7f6062090d
treeb925578ea0cd7632631229bc31f017954de268cb
parent85479eb664530eb2e392a14ccc44e854a232f94d
[PATCH] Fix bugs in ext2_new_inode()

From: Mingming Cao <cmm@us.ibm.com>

I found several bugs/issues in the ext2_new_inode() code:

1) The for loop variable "i" is used to save the inode offset.  In the
   case of failure, the loop variable could be crapped.  So it is possible
   to quit searching before looking at every block groups.

2) The number of free inodes in the selected group is possibly being
   miscalculated.  The counter is only decreased in the find_group_xx()
   functions for the initial selected group.  If the initial try failed,
   and succeed in finding a free inode in other group, the counter for that
   group will not to be decreased.

3) In case of the concurrent case, going back to find_group_xx()
   functions are unnecessary, it will only get the same group as before.

The following patch fixed those issues.  Ideas are stolen from
ext3_new_inode().
fs/ext2/ialloc.c