Skip to content

Commit

Permalink
Btrfs: fix double free in find_lock_delalloc_range
Browse files Browse the repository at this point in the history
commit 7d78874 upstream.

We need to NULL the cached_state after freeing it, otherwise
we might free it again if find_delalloc_range doesn't find anything.

Signed-off-by: Chris Mason <clm@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
masoncl authored and gregkh committed Jul 1, 2014
1 parent 2edae61 commit a25ebe2
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions fs/btrfs/extent_io.c
Expand Up @@ -1551,6 +1551,7 @@ static noinline u64 find_lock_delalloc_range(struct inode *inode,
* shortening the size of the delalloc range we're searching
*/
free_extent_state(cached_state);
cached_state = NULL;
if (!loops) {
unsigned long offset = (*start) & (PAGE_CACHE_SIZE - 1);
max_bytes = PAGE_CACHE_SIZE - offset;
Expand Down

0 comments on commit a25ebe2

Please sign in to comment.