Skip to content

Commit

Permalink
Btrfs: avoid NULL pointer deref in try_release_extent_buffer
Browse files Browse the repository at this point in the history
If we fail to find a pointer in the radix tree, don't try
to deref the NULL one we do have.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
  • Loading branch information
Chris Mason committed Nov 22, 2010
1 parent a1b075d commit 45f49bc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fs/btrfs/extent_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -3837,8 +3837,10 @@ int try_release_extent_buffer(struct extent_io_tree *tree, struct page *page)

spin_lock(&tree->buffer_lock);
eb = radix_tree_lookup(&tree->buffer, start >> PAGE_CACHE_SHIFT);
if (!eb)
goto out;
if (!eb) {
spin_unlock(&tree->buffer_lock);
return ret;
}

if (test_bit(EXTENT_BUFFER_DIRTY, &eb->bflags)) {
ret = 0;
Expand Down

0 comments on commit 45f49bc

Please sign in to comment.