From c3781ee15fb846bc6ad09a09baa2ced404e74e47 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Tue, 20 May 2025 15:54:20 +0200 Subject: 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: f5c84eff634b ("loop: Add sanity check for read/write_iter") Reported-by: Christian Hesse Signed-off-by: Christoph Hellwig Link: https://lore.kernel.org/r/20250520135420.1177312-1-hch@lst.de Signed-off-by: Jens Axboe Cherry-picked-for: https://lore.kernel.org/r/20250519175640.2fcac001@leda.eworm.net --- drivers/block/loop.c | 3 --- 1 file changed, 3 deletions(-) --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -972,9 +972,6 @@ static int loop_configure(struct loop_de 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;