Skip to content

Commit

Permalink
Btrfs: fix use-after-free in btrfs_replay_log
Browse files Browse the repository at this point in the history
@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>
  • Loading branch information
Liu Bo authored and Chris Mason committed Jun 12, 2015
1 parent 9a4e727 commit 0eeff23
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/btrfs/disk-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -2321,8 +2321,9 @@ static int btrfs_replay_log(struct btrfs_fs_info *fs_info,
fs_info->generation + 1);
if (IS_ERR(log_tree_root->node)) {
printk(KERN_ERR "BTRFS: failed to read log tree\n");
ret = PTR_ERR(log_tree_root->node);
kfree(log_tree_root);
return PTR_ERR(log_tree_root->node);
return ret;
} else if (!extent_buffer_uptodate(log_tree_root->node)) {
printk(KERN_ERR "BTRFS: failed to read log tree\n");
free_extent_buffer(log_tree_root->node);
Expand Down

0 comments on commit 0eeff23

Please sign in to comment.