Skip to content

Commit 1ec786c

Browse files
Christoph Hellwigjannau
authored andcommitted
loop: don't require ->write_iter for writable files in loop_configure
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: f5c84ef ("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>
1 parent 18ab382 commit 1ec786c

1 file changed

Lines changed: 0 additions & 3 deletions

File tree

drivers/block/loop.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -972,9 +972,6 @@ static int loop_configure(struct loop_device *lo, blk_mode_t mode,
972972
if (!file)
973973
return -EBADF;
974974

975-
if ((mode & BLK_OPEN_WRITE) && !file->f_op->write_iter)
976-
return -EINVAL;
977-
978975
error = loop_check_backing_file(file);
979976
if (error)
980977
return error;

0 commit comments

Comments
 (0)