]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
btrfs: fix use after free iterating extrefs
authorChris Mason <clm@fb.com>
Tue, 13 Oct 2015 18:06:48 +0000 (14:06 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 27 Oct 2015 00:53:38 +0000 (09:53 +0900)
commite5b73597da65ef419bc46f904d15a415af55776b
tree424eaff96cf94502f63de5335573c402abeda974
parentbf595083549df3aae42f71812f2a66b5a2066053
btrfs: fix use after free iterating extrefs

commit dc6c5fb3b514221f2e9d21ee626a9d95d3418dff upstream.

The code for btrfs inode-resolve has never worked properly for
files with enough hard links to trigger extrefs.  It was trying to
get the leaf out of a path after freeing the path:

btrfs_release_path(path);
leaf = path->nodes[0];
item_size = btrfs_item_size_nr(leaf, slot);

The fix here is to use the extent buffer we cloned just a little higher
up to avoid deadlocks caused by using the leaf in the path.

Signed-off-by: Chris Mason <clm@fb.com>
cc: Mark Fasheh <mfasheh@suse.de>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Mark Fasheh <mfasheh@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/backref.c