ext4: check return of ext4_orphan_get properly
authorJosef Bacik <jbacik@redhat.com>
Wed, 30 Apr 2008 02:04:56 +0000 (22:04 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 30 Apr 2008 02:04:56 +0000 (22:04 -0400)
This patch fix a panic while running fsfuzzer.
We are improperly checking the return of ext4_orphan_get.

Signed-off-by: Josef Bacik <jbacik@redhat.com>
Signed-off-by: Mingming Cao <cmm@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs/ext4/super.c

index c81a8e759bad445b642feeeaca374383169d2b52..425f42778efa81d0c566056cd6b1c8faf5c1a9d8 100644 (file)
@@ -1594,8 +1594,8 @@ static void ext4_orphan_cleanup (struct super_block * sb,
        while (es->s_last_orphan) {
                struct inode *inode;
 
-               if (!(inode =
-                     ext4_orphan_get(sb, le32_to_cpu(es->s_last_orphan)))) {
+               inode = ext4_orphan_get(sb, le32_to_cpu(es->s_last_orphan));
+               if (IS_ERR(inode)) {
                        es->s_last_orphan = 0;
                        break;
                }