summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Garry <john.g.garry@oracle.com>2025-10-20 09:06:46 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-10-23 16:20:42 +0200
commit069e7bbe4382f596232204e48a11e17ed9987ec9 (patch)
treeb82eee9e2e9c4c872ccc3f3e32874beb700f5fc9
parentfd819637d0cf697890d4d826ee9b7e3fa13c14b0 (diff)
downloadlinux-069e7bbe4382f596232204e48a11e17ed9987ec9.tar.gz
linux-069e7bbe4382f596232204e48a11e17ed9987ec9.tar.bz2
linux-069e7bbe4382f596232204e48a11e17ed9987ec9.zip
md/raid0: Handle bio_split() errors
[ Upstream commit 74538fdac3e85aae55eb4ed786478ed2384cb85d ] Add proper bio_split() error handling. For any error, set bi_status, end the bio, and return. Reviewed-by: Yu Kuai <yukuai3@huawei.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: John Garry <john.g.garry@oracle.com> Link: https://lore.kernel.org/r/20241111112150.3756529-5-john.g.garry@oracle.com Signed-off-by: Jens Axboe <axboe@kernel.dk> Stable-dep-of: 22f166218f73 ("md: fix mssing blktrace bio split events") Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/md/raid0.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index 31bea72bcb01..67ec633d27e2 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -464,6 +464,12 @@ static void raid0_handle_discard(struct mddev *mddev, struct bio *bio)
struct bio *split = bio_split(bio,
zone->zone_end - bio->bi_iter.bi_sector, GFP_NOIO,
&mddev->bio_set);
+
+ if (IS_ERR(split)) {
+ bio->bi_status = errno_to_blk_status(PTR_ERR(split));
+ bio_endio(bio);
+ return;
+ }
bio_chain(split, bio);
submit_bio_noacct(bio);
bio = split;
@@ -606,6 +612,12 @@ static bool raid0_make_request(struct mddev *mddev, struct bio *bio)
if (sectors < bio_sectors(bio)) {
struct bio *split = bio_split(bio, sectors, GFP_NOIO,
&mddev->bio_set);
+
+ if (IS_ERR(split)) {
+ bio->bi_status = errno_to_blk_status(PTR_ERR(split));
+ bio_endio(bio);
+ return true;
+ }
bio_chain(split, bio);
raid0_map_submit_bio(mddev, bio);
bio = split;