From: Christoph Hellwig <hch@lst.de>
To: Damien Le Moal <dlemoal@kernel.org>, Jens Axboe <axboe@kernel.dk>
Cc: Josef Bacik <josef@toxicpanda.com>, linux-block@vger.kernel.org
Subject: [PATCH 4/4] zloop: check that the zone backing file support ->{read,write}_iter
Date: Thu, 29 Oct 2026 16:03:35 +0100 [thread overview]
Message-ID: <20261029150353.2503201-5-hch@lst.de> (raw)
In-Reply-To: <20261029150353.2503201-1-hch@lst.de>
I/O to backing files requires support for iter based read/write, so check
for that upfront instead of dereferencing a NULL pointer later.
Fixes: eb0570c7df23 ("block: new zoned loop block device driver")
Reported-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/block/zloop.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/block/zloop.c b/drivers/block/zloop.c
index f0aca9d43851..65634a39b0bf 100644
--- a/drivers/block/zloop.c
+++ b/drivers/block/zloop.c
@@ -1132,6 +1132,11 @@ static int zloop_init_zone(struct zloop_device *zlo, struct zloop_options *opts,
return PTR_ERR(zone->file);
}
+ if (!zone->file->f_op->read_iter || !zone->file->f_op->write_iter) {
+ ret = -EINVAL;
+ goto out_fput;
+ }
+
if (zlo->block_size) {
ret = zloop_get_block_size(zlo, zone);
if (ret)
--
2.53.0
next prev parent reply other threads:[~2026-10-29 15:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-29 15:03 zloop fixes Christoph Hellwig
2026-10-29 15:03 ` [PATCH 1/4] zloop: remove a duplicate call to zloop_get_block_size Christoph Hellwig
2026-10-30 1:11 ` Damien Le Moal
2026-10-29 15:03 ` [PATCH 2/4] zloop: share more code for opening a zone backing file Christoph Hellwig
2026-10-30 1:10 ` Damien Le Moal
2026-10-29 15:03 ` [PATCH 3/4] zloop: fput file after failed zone init Christoph Hellwig
2026-10-30 1:11 ` Damien Le Moal
2026-10-29 15:03 ` Christoph Hellwig [this message]
2026-10-30 1:11 ` [PATCH 4/4] zloop: check that the zone backing file support ->{read,write}_iter Damien Le Moal
2026-10-29 15:34 ` zloop fixes Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261029150353.2503201-5-hch@lst.de \
--to=hch@lst.de \
--cc=axboe@kernel.dk \
--cc=dlemoal@kernel.org \
--cc=josef@toxicpanda.com \
--cc=linux-block@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox