[PATCH 1/4] zram: complete parent bio on allocation failure in read_from_bdev_async()
From: Andrew Stellman
Date: Tue Apr 07 2026 - 08:39:26 EST
read_from_bdev_async() silently returns without completing the parent
bio when either kmalloc or bio_alloc fails. The caller has already
submitted the parent bio for asynchronous completion, so returning
without calling bio_endio(parent) leaves the I/O hanging indefinitely.
Set parent->bi_status to BLK_STS_IOERR and call bio_endio(parent) on
both allocation failure paths, matching the error-completion pattern
used in zram_async_read_endio().
Signed-off-by: Andrew Stellman <astellman@xxxxxxxxxxxxxxxxxxx>
---
drivers/block/zram/zram_drv.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index af67937..f41f1ca 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1437,12 +1437,17 @@ static void read_from_bdev_async(struct zram *zram, struct page *page,
struct bio *bio;
req = kmalloc_obj(*req, GFP_NOIO);
- if (!req)
+ if (!req) {
+ parent->bi_status = BLK_STS_IOERR;
+ bio_endio(parent);
return;
+ }
bio = bio_alloc(zram->bdev, 1, parent->bi_opf, GFP_NOIO);
if (!bio) {
kfree(req);
+ parent->bi_status = BLK_STS_IOERR;
+ bio_endio(parent);
return;
}
--
2.34.1