ext4: Fix buffer head leaks after calls to ext4_get_inode_loc()
authorCurt Wohlgemuth <curtw@google.com>
Sat, 3 Apr 2010 21:44:16 +0000 (17:44 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 3 Apr 2010 21:44:16 +0000 (17:44 -0400)
Calls to ext4_get_inode_loc() returns with a reference to a buffer
head in iloc->bh.  The callers of this function in ext4_write_inode()
when in no journal mode and in ext4_xattr_fiemap() don't release the
buffer head after using it.

Addresses-Google-Bug: #2548165

Signed-off-by: Curt Wohlgemuth <curtw@google.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs/ext4/extents.c
fs/ext4/inode.c

index 94c8ee81f5e1e38aa52964f95ab6b7dc9a51eae4..236b834b4ca811913f98caf6c9a264844fe8f7de 100644 (file)
@@ -3879,6 +3879,7 @@ static int ext4_xattr_fiemap(struct inode *inode,
                physical += offset;
                length = EXT4_SB(inode->i_sb)->s_inode_size - offset;
                flags |= FIEMAP_EXTENT_DATA_INLINE;
+               brelse(iloc.bh);
        } else { /* external block */
                physical = EXT4_I(inode)->i_file_acl << blockbits;
                length = inode->i_sb->s_blocksize;
index 87e3c70d0692b3e6e5f2a5206c50ab5d43d18caf..ba1eee847e32118b91693da17e64a2f901ab22e0 100644 (file)
@@ -5385,6 +5385,7 @@ int ext4_write_inode(struct inode *inode, struct writeback_control *wbc)
                                   (unsigned long long)iloc.bh->b_blocknr);
                        err = -EIO;
                }
+               brelse(iloc.bh);
        }
        return err;
 }