From 8067a3a5c2b35c7c8ba6a52801fcc29cf4dc5641 Mon Sep 17 00:00:00 2001
From: Lee Duncan <lduncan@suse.com>
Date: May 30 2025 17:56:40 +0000
Subject: loop: don't require ->write_iter for writable files in

loop_configure (git-fixes).

---

diff --git a/patches.suse/loop-don-t-require-write_iter-for-writable-files-in-loop_c.patch b/patches.suse/loop-don-t-require-write_iter-for-writable-files-in-loop_c.patch
new file mode 100644
index 0000000..7ec362d
--- /dev/null
+++ b/patches.suse/loop-don-t-require-write_iter-for-writable-files-in-loop_c.patch
@@ -0,0 +1,39 @@
+From: Christoph Hellwig <hch@lst.de>
+Date: Tue, 20 May 2025 15:54:20 +0200
+Subject: loop: don't require ->write_iter for writable files in loop_configure
+Git-commit: 355341e4359b2d5edf0ed5e117f7e9e7a0a5dac0
+Patch-mainline: v6.15
+References: git-fixes
+
+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>
+Acked-by: Lee Duncan <lduncan@suse.com>
+---
+ drivers/block/loop.c | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/drivers/block/loop.c b/drivers/block/loop.c
+index b8ba7de08753..e2b1f377f585 100644
+--- a/drivers/block/loop.c
++++ b/drivers/block/loop.c
+@@ -979,9 +979,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;
+
diff --git a/series.conf b/series.conf
index 3ac69b5..343745c 100644
--- a/series.conf
+++ b/series.conf
@@ -31916,6 +31916,7 @@
 	patches.suse/can-bcm-add-locking-for-bcm_op-runtime-updates.patch
 	patches.suse/can-bcm-add-missing-rcu-read-protection-for-procfs-c.patch
 	patches.suse/can-slcan-allow-reception-of-short-error-messages.patch
+	patches.suse/loop-don-t-require-write_iter-for-writable-files-in-loop_c.patch
 	patches.suse/platform-x86-dell-wmi-sysman-Avoid-buffer-overflow-i.patch
 	patches.suse/thermal-intel-x86_pkg_temp_thermal-Fix-bogus-trip-te.patch
 	patches.suse/drm-edid-fixed-the-bug-that-hdr-metadata-was-not-res.patch