From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Nicolin Chen <nicolinc@nvidia.com>,
Pranjal Shrivastava <praan@google.com>,
Kevin Tian <kevin.tian@intel.com>,
Jason Gunthorpe <jgg@nvidia.com>, Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.12.y 2/3] iommufd: Break the loop on failure in iommufd_fault_fops_read()
Date: Tue, 21 Jul 2026 13:13:52 -0400 [thread overview]
Message-ID: <20260721171353.111431-2-sashal@kernel.org> (raw)
In-Reply-To: <20260721171353.111431-1-sashal@kernel.org>
From: Nicolin Chen <nicolinc@nvidia.com>
[ 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.
Fixes: 07838f7fd529 ("iommufd: Add iommufd fault object")
Link: https://patch.msgid.link/r/336a9b6e44fe66a24199d3be777c405c85c98622.1780343944.git.nicolinc@nvidia.com
Cc: stable@vger.kernel.org
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Reviewed-by: Pranjal Shrivastava <praan@google.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
[ sashal: applied to fault.c as 6.12 lacks the eventq.c split ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/iommu/iommufd/fault.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/iommu/iommufd/fault.c b/drivers/iommu/iommufd/fault.c
index 6048d8a1c8380e..ff454494191352 100644
--- a/drivers/iommu/iommufd/fault.c
+++ b/drivers/iommu/iommufd/fault.c
@@ -299,6 +299,8 @@ static ssize_t iommufd_fault_fops_read(struct file *filep, char __user *buf,
}
done += fault_size;
}
+ if (rc)
+ break;
}
mutex_unlock(&fault->mutex);
--
2.53.0
next prev parent reply other threads:[~2026-07-21 17:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-16 11:37 FAILED: patch "[PATCH] iommufd: Avoid partial fault group delivery in" failed to apply to 6.12-stable tree gregkh
2026-07-21 17:13 ` [PATCH 6.12.y 1/3] iommufd: Reject invalid read count in iommufd_fault_fops_read() Sasha Levin
2026-07-21 17:13 ` Sasha Levin [this message]
2026-07-21 17:13 ` [PATCH 6.12.y 3/3] iommufd: Avoid partial fault group delivery " Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260721171353.111431-2-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=jgg@nvidia.com \
--cc=kevin.tian@intel.com \
--cc=nicolinc@nvidia.com \
--cc=praan@google.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.