Liu Bo
1a932ef4e4
Btrfs: fix use-after-free on root->orphan_block_rsv
I got these from running generic/475,
WARNING: CPU: 0 PID: 26384 at fs/btrfs/inode.c:3326 btrfs_orphan_commit_root+0x1ac/0x2b0 [btrfs]
BUG: unable to handle kernel NULL pointer dereference at 0000000000000010
IP: btrfs_block_rsv_release+0x1c/0x70 [btrfs]
Call Trace:
btrfs_orphan_release_metadata+0x9f/0x200 [btrfs]
btrfs_orphan_del+0x10d/0x170 [btrfs]
btrfs_setattr+0x500/0x640 [btrfs]
notify_change+0x7ae/0x870
do_truncate+0xca/0x130
vfs_truncate+0x2ee/0x3d0
do_sys_truncate+0xaf/0xf0
SyS_truncate+0xe/0x10
entry_SYSCALL_64_fastpath+0x1f/0x96
The race is between btrfs_orphan_commit_root and btrfs_orphan_del,
t1 t2
btrfs_orphan_commit_root btrfs_orphan_del
spin_lock
check (&root->orphan_inodes)
root->orphan_block_rsv = NULL;
spin_unlock
atomic_dec(&root->orphan_inodes);
access root->orphan_block_rsv
Accessing root->orphan_block_rsv must be done before decreasing
root->orphan_inodes.
cc: <stable@vger.kernel.org> v3.12+
Fixes: 703c88e035
("Btrfs: fix tracking of orphan inode count")
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2018-02-02 16:24:40 +01:00
..
2018-01-22 16:08:22 +01:00
2017-08-21 17:47:42 +02:00
2017-10-30 12:27:57 +01:00
2017-08-16 14:19:53 +02:00
2018-01-22 16:08:14 +01:00
2017-11-01 20:45:34 +01:00
2017-11-01 20:45:35 +01:00
2017-11-01 20:45:36 +01:00
2016-12-06 16:06:59 +01:00
2018-01-22 16:08:19 +01:00
2018-01-22 16:08:16 +01:00
2018-01-22 16:08:19 +01:00
2018-01-22 16:08:22 +01:00
2016-07-26 13:52:25 +02:00
2018-01-22 16:08:11 +01:00
2017-04-18 14:07:23 +02:00
2018-01-22 16:08:11 +01:00
2018-01-22 16:08:11 +01:00
2018-01-22 16:08:15 +01:00
2017-02-28 14:26:07 +01:00
2018-01-22 16:08:12 +01:00
2018-01-22 16:08:21 +01:00
2018-01-22 16:08:13 +01:00
2018-01-22 16:08:12 +01:00
2017-11-02 11:10:55 +01:00
2018-01-22 16:08:19 +01:00
2018-01-22 16:08:19 +01:00
2018-01-22 16:08:22 +01:00
2018-01-22 16:08:22 +01:00
2018-01-22 16:08:21 +01:00
2017-07-05 16:41:23 -07:00
2018-01-22 16:08:20 +01:00
2018-01-22 16:08:19 +01:00
2017-02-17 12:03:56 +01:00
2017-10-30 12:27:59 +01:00
2017-08-18 16:36:29 +02:00
2017-06-08 17:36:03 +08:00
2016-06-06 14:08:28 +02:00
2016-12-06 16:06:59 +01:00
2017-11-01 20:45:35 +01:00
2017-11-02 11:10:55 +01:00
2018-02-02 16:24:40 +01:00
2018-01-22 16:08:21 +01:00
2017-10-30 12:28:00 +01:00
2016-01-07 14:30:52 +01:00
2014-11-19 10:34:35 -08:00
2017-11-01 20:45:29 +01:00
2018-01-22 16:08:22 +01:00
2015-03-03 17:23:57 +01:00
2017-11-01 20:45:35 +01:00
2017-06-29 20:17:02 +02:00
2014-09-17 13:37:12 -07:00
2017-08-21 17:47:43 +02:00
2017-08-16 16:12:03 +02:00
2018-01-22 16:08:16 +01:00
2014-01-28 13:20:24 -08:00
2018-01-22 16:08:12 +01:00
2017-06-29 20:17:02 +02:00
2018-01-22 16:08:21 +01:00
2016-12-06 16:06:59 +01:00
2017-06-19 18:25:59 +02:00
2018-01-22 16:08:13 +01:00
2017-10-30 12:28:00 +01:00
2017-11-15 17:27:46 +01:00
2018-01-22 16:08:12 +01:00
2018-01-22 16:08:20 +01:00
2018-01-22 16:08:12 +01:00
2017-10-30 12:27:59 +01:00
2017-08-16 14:19:53 +02:00
2018-01-22 16:08:20 +01:00
2018-01-22 16:08:11 +01:00
2017-11-14 13:35:29 -08:00
2018-01-22 16:08:20 +01:00
2018-01-22 16:08:14 +01:00
2018-01-22 16:08:21 +01:00
2017-11-28 14:59:09 +01:00
2015-12-18 02:51:32 +00:00
2018-02-02 16:24:30 +01:00
2017-02-14 15:50:54 +01:00
2017-02-17 12:03:50 +01:00
2017-02-17 12:03:50 +01:00
2016-12-19 18:08:15 +01:00
2018-01-29 19:31:16 +01:00
2018-01-22 16:08:21 +01:00
2018-01-22 16:08:12 +01:00
2016-05-17 19:17:09 -04:00
2017-11-01 20:45:29 +01:00
2018-01-22 16:08:14 +01:00