Skip to content

Commit

Permalink
ext4: Fix buffer head leaks after calls to ext4_get_inode_loc()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Curt Wohlgemuth authored and Theodore Ts'o committed Apr 3, 2010
1 parent 8b472d7 commit fd2dd9f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions fs/ext4/extents.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions fs/ext4/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit fd2dd9f

Please sign in to comment.