]> git.proxmox.com Git - mirror_ubuntu-bionic-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)
committerSeth Forshee <seth.forshee@canonical.com>
Fri, 23 Feb 2018 14:27:33 +0000 (08:27 -0600)
commite94ea1a249f948e0691adcdcf1614f4b376edcc9
tree759ef05c16e158ee3e8ff486f4210751da59f478
parent0c76559b994d00ebc7d72e419eb1c03697bab253
Btrfs: fix crash due to not cleaning up tree log block's dirty bits

BugLink: http://bugs.launchpad.net/bugs/1751131
commit 1846430c24d66e85cc58286b3319c82cd54debb2 upstream.

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: 681ae50917df ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
fs/btrfs/tree-log.c