diff options
author | John Garry <john.g.garry@oracle.com> | 2024-11-11 12:21:47 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2024-11-11 16:35:46 +0100 |
commit | 6eb09685885a4445da31097aa6418ee1875f9cec (patch) | |
tree | 0eab45b6a5de2cdb8b72169e1050dff3d988f390 /block | |
parent | block: Error an attempt to split an atomic write in bio_split() (diff) | |
download | linux-6eb09685885a4445da31097aa6418ee1875f9cec.tar.xz linux-6eb09685885a4445da31097aa6418ee1875f9cec.zip |
block: Handle bio_split() errors in bio_submit_split()
bio_split() may error, so check this.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.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-4-john.g.garry@oracle.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-merge.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/block/blk-merge.c b/block/blk-merge.c index d813d799cee7..4cbccdbba638 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -107,17 +107,18 @@ static unsigned int bio_allowed_max_sectors(const struct queue_limits *lim) static struct bio *bio_submit_split(struct bio *bio, int split_sectors) { - if (unlikely(split_sectors < 0)) { - bio->bi_status = errno_to_blk_status(split_sectors); - bio_endio(bio); - return NULL; - } + if (unlikely(split_sectors < 0)) + goto error; if (split_sectors) { struct bio *split; split = bio_split(bio, split_sectors, GFP_NOIO, &bio->bi_bdev->bd_disk->bio_split); + if (IS_ERR(split)) { + split_sectors = PTR_ERR(split); + goto error; + } split->bi_opf |= REQ_NOMERGE; blkcg_bio_issue_init(split); bio_chain(split, bio); @@ -128,6 +129,10 @@ static struct bio *bio_submit_split(struct bio *bio, int split_sectors) } return bio; +error: + bio->bi_status = errno_to_blk_status(split_sectors); + bio_endio(bio); + return NULL; } struct bio *bio_split_discard(struct bio *bio, const struct queue_limits *lim, |