btrfs: do not clean up repair bio if submit fails
authorJosef Bacik <josef@toxicpanda.com>
Thu, 10 Feb 2022 22:44:26 +0000 (17:44 -0500)
committerDavid Sterba <dsterba@suse.com>
Tue, 15 Feb 2022 15:55:32 +0000 (16:55 +0100)
commitdf89c4c9c037c56e2317d3f00dbafd57ed161b0c
tree0cc932118a42385a9da71176e0716035f6cc211b
parent5ba2cd2be13775d25e163753afcc1fc97b11ffff
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 UAF and NULL
pointer deref bugs because we race with the endio function that is
cleaning up the bio.  Instead just return 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.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent_io.c