Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1254832
| From | Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 3.14 14/25] btrfs: fix use after free iterating extrefs |
| Date | 2015-10-23 20:20 +0200 |
| Message-ID | <qmP6A-Po-43@gated-at.bofh.it> (permalink) |
| References | <qmONc-d5-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <clm@fb.com>
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 | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -1692,7 +1692,6 @@ static int iterate_inode_extrefs(u64 inu
int found = 0;
struct extent_buffer *eb;
struct btrfs_inode_extref *extref;
- struct extent_buffer *leaf;
u32 item_size;
u32 cur_offset;
unsigned long ptr;
@@ -1720,9 +1719,8 @@ static int iterate_inode_extrefs(u64 inu
btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK);
btrfs_release_path(path);
- leaf = path->nodes[0];
- item_size = btrfs_item_size_nr(leaf, slot);
- ptr = btrfs_item_ptr_offset(leaf, slot);
+ item_size = btrfs_item_size_nr(eb, slot);
+ ptr = btrfs_item_ptr_offset(eb, slot);
cur_offset = 0;
while (cur_offset < item_size) {
@@ -1736,7 +1734,7 @@ static int iterate_inode_extrefs(u64 inu
if (ret)
break;
- cur_offset += btrfs_inode_extref_name_len(leaf, extref);
+ cur_offset += btrfs_inode_extref_name_len(eb, extref);
cur_offset += sizeof(*extref);
}
btrfs_tree_read_unlock_blocking(eb);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 3.14 00/25] 3.14.56-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-23 20:20 +0200 [PATCH 3.14 02/25] af_unix: Convert the unix_sk macro to an inline function for type safety Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-23 20:20 +0200 [PATCH 3.14 24/25] sched/preempt: Rename PREEMPT_CHECK_OFFSET to PREEMPT_DISABLE_OFFSET Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-23 20:20 +0200 [PATCH 3.14 14/25] btrfs: fix use after free iterating extrefs Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-23 20:20 +0200 [PATCH 3.14 06/25] skbuff: Fix skb checksum partial check. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-23 20:20 +0200 [PATCH 3.14 15/25] arm64: errata: use KBUILD_CFLAGS_MODULE for erratum #843419 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-23 20:20 +0200 [PATCH 3.14 16/25] i2c: rcar: enable RuntimePM before registering to the core Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-23 20:20 +0200 [PATCH 3.14 25/25] sched/preempt: Fix cond_resched_lock() and cond_resched_softirq() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-23 20:20 +0200 [PATCH 3.14 05/25] skbuff: Fix skb checksum flag on skb pull Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-23 20:20 +0200 [PATCH 3.14 09/25] ethtool: Use kcalloc instead of kmalloc for ethtool_get_strings Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-23 20:20 +0200 Re: [PATCH 3.14 00/25] 3.14.56-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2015-10-23 23:10 +0200 Re: [PATCH 3.14 00/25] 3.14.56-stable review Guenter Roeck <linux@roeck-us.net> - 2015-10-24 04:10 +0200
csiph-web