]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: do not clean up repair bio if submit fails
authorJosef Bacik <josef@toxicpanda.com>
Fri, 18 Feb 2022 15:03:29 +0000 (10:03 -0500)
committerDavid Sterba <dsterba@suse.com>
Mon, 14 Mar 2022 12:13:52 +0000 (13:13 +0100)
commit4f49a309c978ef7b35f2bb16fa34e663bc47c50a
tree9770c317e743660f892e3a50fa3fddaa93752134
parentc6ea00f355b7b5dccfd6c088a36c10add07cfcc8
btrfs: do not clean up repair bio if submit fails

The submit helper will always run bio_endio() on the bio if it fails to
submit, so cleaning up the bio just leads to a variety of use-after-free
and NULL pointer dereference bugs because we race with the endio
function that is cleaning up the bio.  Instead just return BLK_STS_OK as
the repair function has to continue to process the rest of the pages,
and the endio for the repair bio will do the appropriate cleanup for the
page that it was given.

Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent_io.c