summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2025-05-20 15:54:20 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-05-29 11:03:17 +0200
commitcd7f022296972daf35b750c3fa71a6bc9ebc0abf (patch)
tree14e3d4e26832a1ec2fde5f6e9aab7c4c6b886546
parentf6f5e9c8cb680c3cb9771fd9fa114319cbc4f514 (diff)
loop: don't require ->write_iter for writable files in loop_configure
[ Upstream commit 355341e4359b2d5edf0ed5e117f7e9e7a0a5dac0 ] Block devices can be opened read-write even if they can't be written to for historic reasons. Remove the check requiring file->f_op->write_iter when the block devices was opened in loop_configure. The call to loop_check_backing_file just below ensures the ->write_iter is present for backing files opened for writing, which is the only check that is actually needed. Fixes: f5c84eff634b ("loop: Add sanity check for read/write_iter") Reported-by: Christian Hesse <mail@eworm.de> Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20250520135420.1177312-1-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/block/loop.c3
1 files changed, 0 insertions, 3 deletions
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index fa9c77b8f4d2..0843d229b0f7 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -969,9 +969,6 @@ static int loop_configure(struct loop_device *lo, blk_mode_t mode,
if (!file)
return -EBADF;
- if ((mode & BLK_OPEN_WRITE) && !file->f_op->write_iter)
- return -EINVAL;
-
error = loop_check_backing_file(file);
if (error)
return error;