diff options
author | Liu Bo <bo.li.liu@oracle.com> | 2015-06-11 02:16:44 -0400 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2015-06-12 14:03:21 -0400 |
commit | 0eeff2362b829b5e80f8b69f86b60b8094bc742d (patch) | |
tree | c1b6a793279d145309aa681817bd8644561af660 /fs/btrfs/disk-io.c | |
parent | 9a4e7276d39071576d369e607d7accb84b41d0b4 (diff) |
Btrfs: fix use-after-free in btrfs_replay_log
@log_root_tree should not be referenced after kfree.
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.cz>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 695363ae1c28..b7fa3bac2cff 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -2321,8 +2321,9 @@ static int btrfs_replay_log(struct btrfs_fs_info *fs_info, | |||
2321 | fs_info->generation + 1); | 2321 | fs_info->generation + 1); |
2322 | if (IS_ERR(log_tree_root->node)) { | 2322 | if (IS_ERR(log_tree_root->node)) { |
2323 | printk(KERN_ERR "BTRFS: failed to read log tree\n"); | 2323 | printk(KERN_ERR "BTRFS: failed to read log tree\n"); |
2324 | ret = PTR_ERR(log_tree_root->node); | ||
2324 | kfree(log_tree_root); | 2325 | kfree(log_tree_root); |
2325 | return PTR_ERR(log_tree_root->node); | 2326 | return ret; |
2326 | } else if (!extent_buffer_uptodate(log_tree_root->node)) { | 2327 | } else if (!extent_buffer_uptodate(log_tree_root->node)) { |
2327 | printk(KERN_ERR "BTRFS: failed to read log tree\n"); | 2328 | printk(KERN_ERR "BTRFS: failed to read log tree\n"); |
2328 | free_extent_buffer(log_tree_root->node); | 2329 | free_extent_buffer(log_tree_root->node); |