From: Chris Mason Date: Mon, 22 Nov 2010 03:27:44 +0000 (-0500) Subject: Btrfs: avoid NULL pointer deref in try_release_extent_buffer X-Git-Tag: firefly_0821_release~7613^2~2263^2~81 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=45f49bce99d008d6864a20324548f35936ba46fb;p=firefly-linux-kernel-4.4.55.git Btrfs: avoid NULL pointer deref in try_release_extent_buffer 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 --- diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index f60aa3c35c23..143d3f541d64 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -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;