mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
zloop: check that the zone backing file support ->{read,write}_iter
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: eb0570c7df ("block: new zoned loop block device driver")
Reported-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://patch.msgid.link/20261029150353.2503201-5-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
134ffb0755
commit
0c10f8a1a7
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user