Skip to content

Commit 355341e

Browse files
Christoph Hellwigaxboe
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 <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent dd24f87 commit 355341e

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

drivers/block/loop.c

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

982-
if ((mode & BLK_OPEN_WRITE) && !file->f_op->write_iter)
983-
return -EINVAL;
984-
985982
error = loop_check_backing_file(file);
986983
if (error)
987984
return error;

0 commit comments

Comments
 (0)