]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: fix crash due to not cleaning up tree log block's dirty bits
authorLiu Bo <bo.li.liu@oracle.com>
Thu, 25 Jan 2018 18:02:51 +0000 (11:02 -0700)
committerDavid Sterba <dsterba@suse.com>
Fri, 2 Feb 2018 15:24:24 +0000 (16:24 +0100)
commitf73b008b2f3be05a6a879f0b697cddb5777ff29b
treea6bd680f201d90cc007254cb988093b41b936f8c
parent323547b6715f1f15bd785c3f2050a379c1f49fd3
Btrfs: fix crash due to not cleaning up tree log block's dirty bits

In cases that the whole fs flips into readonly status due to failures in
critical sections, then log tree's blocks are still dirty, and this leads
to a crash during umount time, the crash is about use-after-free,

umount
 -> close_ctree
    -> stop workers
    -> iput(btree_inode)
       -> iput_final
          -> write_inode_now
     -> ...
       -> queue job on stop'd workers

cc: <stable@vger.kernel.org> v3.12+
Fixes: 9e21bd8c6f18 ("Btrfs: cleanup reserved space when freeing tree log on error")
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>
fs/btrfs/tree-log.c