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: 703c88e03524 ("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
..
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2018-01-02 10:02:19 +00:00
2017-12-14 16:00:48 -08:00
2017-11-27 13:05:09 -08:00
2017-11-02 11:10:55 +01:00
2018-02-02 16:24:40 +01:00
2017-11-15 18:21:06 -08:00
2017-12-08 11:07:12 +01:00
2017-12-06 12:48:01 -06:00
2017-11-27 13:05:09 -08:00
2017-10-19 16:15:16 +02:00
2017-12-17 12:20:58 -08:00
2017-11-14 11:35:15 -08:00
2017-11-07 20:25:03 +01:00
2017-08-24 13:23:03 -07:00
2017-11-14 14:44:04 -08:00
2017-11-27 13:05:09 -08:00
2017-07-11 06:09:21 -04:00
2017-11-27 13:05:09 -08:00
2017-09-07 11:59:42 -07:00
2017-11-27 13:05:09 -08:00
2017-12-11 15:00:57 -05:00
2017-11-27 13:05:09 -08:00
2017-11-29 18:40:43 -08:00
2017-11-27 13:05:09 -08:00
2017-11-16 11:41:22 -08:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-11-02 11:10:55 +01:00
2017-12-10 12:58:18 -08:00
2017-11-29 18:40:43 -08:00
2017-11-27 13:05:09 -08:00
2017-11-17 09:51:57 -08:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-11-27 16:45:11 -05:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-12-16 13:12:53 -08:00
2017-11-27 16:45:11 -05:00
2017-12-14 16:00:49 -08:00
2017-11-27 13:05:09 -08:00
2017-11-02 11:10:55 +01:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-11-02 11:10:55 +01:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-12-14 11:14:52 +01:00
2018-01-19 10:09:41 -08:00
2017-11-21 15:57:05 -08:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-11-29 16:46:48 +01:00
2017-09-06 17:27:26 -07:00
2017-11-30 18:38:47 -05:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-07-06 03:31:46 -04:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2018-01-05 12:59:32 -08:00
2017-11-17 11:54:55 -08:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-09-04 19:05:15 -04:00
2017-11-17 12:54:01 -08:00
2017-11-16 12:50:35 -08:00
2017-11-02 11:10:55 +01:00
2017-10-13 16:18:33 -07:00
2017-10-03 17:54:25 -07:00
2017-11-14 15:32:19 -08:00
2017-11-15 18:21:06 -08:00
2017-11-02 11:10:55 +01:00
2017-11-17 12:54:01 -08:00
2017-04-17 12:52:27 -04:00
2017-11-17 11:54:55 -08:00
2017-12-15 18:53:22 -08:00
2017-11-15 18:21:04 -08:00
2017-11-14 15:32:19 -08:00
2017-11-02 11:10:55 +01:00
2017-07-03 21:13:25 -07:00
2017-11-17 16:56:17 -08:00
2018-01-03 10:13:36 -08:00
2017-11-15 08:08:36 -05:00
2017-11-17 12:54:01 -08:00
2017-11-15 18:21:04 -08:00
2017-11-17 12:54:01 -08:00
2017-11-02 11:10:55 +01:00
2017-11-07 10:32:44 +01:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-11-10 08:48:46 -05:00
2017-11-02 11:10:55 +01:00
2017-11-17 12:08:18 -08:00
2017-07-12 16:26:00 -07:00
2017-09-10 19:31:46 -04:00
2017-11-27 13:05:09 -08:00
2017-11-27 13:05:09 -08:00
2017-11-02 11:10:55 +01:00
2017-11-29 18:40:43 -08:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-29 18:40:43 -08:00
2017-12-09 20:16:33 -05:00
2017-11-27 13:05:09 -08:00
2017-09-05 12:53:12 +02:00
2017-11-17 16:10:03 -08:00
2017-05-23 08:41:17 -05:00
2017-11-27 13:05:09 -08:00
2017-11-17 12:08:18 -08:00
2017-11-07 10:32:44 +01:00
2017-11-17 11:54:55 -08:00
2017-11-02 11:10:55 +01:00
2017-11-17 11:54:55 -08:00
2017-10-25 11:01:08 +02:00
2017-11-02 11:10:55 +01:00
2017-11-27 13:05:09 -08:00
2017-12-18 15:05:07 -05:00
2017-11-14 15:32:19 -08:00
2017-11-02 11:10:55 +01:00
2018-01-04 16:45:09 -08:00
2017-11-02 11:10:55 +01:00
2017-10-04 18:03:15 +11:00