Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Liu Bo and committed by
Chris Mason
0eeff236 9a4e7276

+2 -1
+2 -1
fs/btrfs/disk-io.c
··· 2321 2321 fs_info->generation + 1); 2322 2322 if (IS_ERR(log_tree_root->node)) { 2323 2323 printk(KERN_ERR "BTRFS: failed to read log tree\n"); 2324 + ret = PTR_ERR(log_tree_root->node); 2324 2325 kfree(log_tree_root); 2325 - return PTR_ERR(log_tree_root->node); 2326 + return ret; 2326 2327 } else if (!extent_buffer_uptodate(log_tree_root->node)) { 2327 2328 printk(KERN_ERR "BTRFS: failed to read log tree\n"); 2328 2329 free_extent_buffer(log_tree_root->node);