Skip to contentSkip to conversation

FAILED: patch "[PATCH] iommufd: Break the loop on failure in" failed to apply to 6.12-stable tree

PATCH New [email protected] 2 participants 2 messages Jul 16 – Jul 21

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x 172fc8b19825a0f5884c38f2289188284e2d45ee
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026071611-prong-distrust-2ab3@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..'

Possible dependencies:

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 172fc8b19825a0f5884c38f2289188284e2d45ee Mon Sep 17 00:00:00 2001
From: Nicolin Chen <[email protected]>
Date: Mon, 1 Jun 2026 13:42:36 -0700
Subject: [PATCH] iommufd: Break the loop on failure in
iommufd_fault_fops_read()

On a copy_to_user() failure inside the inner list_for_each_entry, only the inner loop breaks; the outer while re-fetches the just-restored fault group and retries the failing copy_to_user() forever, spinning the reader at 100% CPU with fault->mutex held.

Check rc after the inner loop and break the outer while as well.

drivers/iommu/iommufd/eventq.c +2 -0
index 613024ca8f1f..1c010e691f97 100644
@@ -168,6 +168,8 @@ static ssize_t iommufd_fault_fops_read(struct file *filep, char __user *buf,
 			}
 			done += fault_size;
 		}
+		if (rc)
+			break;
 	}
 	mutex_unlock(&fault->mutex);
 
maintainer
#1 lore raw

PATCH 1/1 iommufd: Break the loop on failure in iommufd_fault_fops_read()

From: Nicolin Chen <[email protected]>

[ Upstream commit 172fc8b19825a0f5884c38f2289188284e2d45ee ]

On a copy_to_user() failure inside the inner list_for_each_entry, only the inner loop breaks; the outer while re-fetches the just-restored fault group and retries the failing copy_to_user() forever, spinning the reader at 100% CPU with fault->mutex held.

Check rc after the inner loop and break the outer while as well.

---
 drivers/iommu/iommufd/fault.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/iommu/iommufd/fault.c +2 -0
index 8226e28d79a510..4b37244003f2d7 100644
@@ -296,6 +296,8 @@ static ssize_t iommufd_fault_fops_read(struct file *filep, char __user *buf,
 			}
 			done += fault_size;
 		}
+		if (rc)
+			break;
 	}
 	mutex_unlock(&fault->mutex);
 
Signature · 1 line
2.53.0