]> 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)
commita00338bcb0a785b154cb9f00d806e453720cdfe5
tree9770c317e743660f892e3a50fa3fddaa93752134
parentabfd0190694ad2bfd1bd89a58e52416ab860cd2e
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