Skip to contentSkip to conversation

FAILED: patch "[PATCH] iommufd: Reject invalid read count 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 47916a54eeb2a9e654512ee609f71bd5b29db702
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026071602-java-pointing-40af@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..'

Possible dependencies:

thanks,

greg k-h

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

From 47916a54eeb2a9e654512ee609f71bd5b29db702 Mon Sep 17 00:00:00 2001
From: Nicolin Chen <[email protected]>
Date: Mon, 1 Jun 2026 13:42:35 -0700
Subject: [PATCH] iommufd: Reject invalid read count in
iommufd_fault_fops_read()

The read count must be large enough to hold one fault or a group's faults.

iommufd_fault_fops_read() does not validate the count, but returns 0 as if the read had succeeded while leaving the pending fault in the queue.

Return -EINVAL in the undersize cases.

drivers/iommu/iommufd/eventq.c +3 -0
index f55d173c59f6..613024ca8f1f 100644
@@ -142,6 +142,9 @@ static ssize_t iommufd_fault_fops_read(struct file *filep, char __user *buf,
 		if (done >= count ||
 		    group->fault_count * fault_size > count - done) {
 			iommufd_fault_deliver_restore(fault, group);
+			/* Read count doesn't fit the first fault group */
+			if (done == 0)
+				rc = -EINVAL;
 			break;
 		}
 
maintainer
#1 lore raw

PATCH 1/1 iommufd: Reject invalid read count in iommufd_fault_fops_read()

From: Nicolin Chen <[email protected]>

[ Upstream commit 47916a54eeb2a9e654512ee609f71bd5b29db702 ]

The read count must be large enough to hold one fault or a group's faults.

iommufd_fault_fops_read() does not validate the count, but returns 0 as if the read had succeeded while leaving the pending fault in the queue.

Return -EINVAL in the undersize cases.

---
 drivers/iommu/iommufd/fault.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/iommu/iommufd/fault.c +3 -0
index 8226e28d79a510..6048d8a1c8380e 100644
@@ -273,6 +273,9 @@ static ssize_t iommufd_fault_fops_read(struct file *filep, char __user *buf,
 		if (done >= count ||
 		    group->fault_count * fault_size > count - done) {
 			iommufd_fault_deliver_restore(fault, group);
+			/* Read count doesn't fit the first fault group */
+			if (done == 0)
+				rc = -EINVAL;
 			break;
 		}
 
Signature · 1 line
2.53.0