[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190314075041.28966-1-kjlu@umn.edu>
Date: Thu, 14 Mar 2019 02:50:40 -0500
From: Kangjie Lu <kjlu@....edu>
To: kjlu@....edu
Cc: pakki001@....edu, Chris Mason <clm@...com>,
Josef Bacik <josef@...icpanda.com>,
David Sterba <dsterba@...e.com>, linux-btrfs@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] btrfs: fix a NULL pointer dereference
btrfs_lookup_block_group may fail and return NULL. The fix goes
to out when it fails to avoid NULL pointer dereference.
Signed-off-by: Kangjie Lu <kjlu@....edu>
---
fs/btrfs/extent-tree.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 994f0cc41799..b1e7985bcb9d 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -7303,6 +7303,8 @@ void btrfs_free_tree_block(struct btrfs_trans_handle *trans,
pin = 0;
cache = btrfs_lookup_block_group(fs_info, buf->start);
+ if (!cache)
+ goto out;
if (btrfs_header_flag(buf, BTRFS_HEADER_FLAG_WRITTEN)) {
pin_down_extent(fs_info, cache, buf->start,
--
2.17.1
Powered by blists - more mailing lists