From: Frank Li <Frank.li@oss.nxp.com>
To: Daniel Byrne <daniel1.byrne@intel.com>
Cc: Vinod Koul <vkoul@kernel.org>,
dmaengine@vger.kernel.org,
Vinicius Costa Gomes <vinicius.gomes@intel.com>,
Dave Jiang <dave.jiang@intel.com>, Frank Li <Frank.Li@kernel.org>,
Fenghua Yu <fenghuay@nvidia.com>, Dan Williams <djbw@kernel.org>,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v2 01/10] dmaengine: idxd: don't queue EVL fault work for kernel WQs
Date: Thu, 3 Dec 2026 11:47:02 -0600 [thread overview]
Message-ID: <axGrFlLFIRlSKOCy@SMW015318> (raw)
In-Reply-To: <20261130194721.1900266-2-daniel1.byrne@intel.com>
On Mon, Nov 30, 2026 at 11:47:12AM -0800, Daniel Byrne wrote:
> The event log fault path queues work on wq->wq, the workqueue that only
> the user (cdev) driver creates for its work queues. A completion record
> fault logged for a kernel work queue, a dmaengine or iaa_crypto queue,
> finds that pointer NULL and queue_work() dereferences it.
>
> The fault worker only serves user contexts. It copies the completion
> record through the PASID xarray that cdev opens populate. On a kernel
> work queue there is nothing to do, so log the entry rate-limited and
> drop it. Test the queue's type and not the pointer alone, since a user
> probe that failed leaves the pointer dangling. The warning names the
> queue's type, because the same test drops an entry for a queue whose
> user driver was unbound after the entry was logged, and for a queue
> retyped to user while disabled.
>
> Fixes: c40bd7d9737b ("dmaengine: idxd: process user page faults for completion record")
> Cc: stable@vger.kernel.org # 6.4+
> Signed-off-by: Daniel Byrne <daniel1.byrne@intel.com>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> v2: the test is unchanged. The warning no longer says "kernel wq" and
> prints the queue's type, since the same test also drops the record of a
> user queue whose cdev driver is not bound; the comment says so, and the
> message adds a queue retyped to user while disabled. The wq declaration
> moves to the top of the block.
>
> drivers/dma/idxd/irq.c | 19 +++++++++++++++++--
> 1 file changed, 17 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/dma/idxd/irq.c b/drivers/dma/idxd/irq.c
> index 6a25e1fd0e62..7ae73bb39548 100644
> --- a/drivers/dma/idxd/irq.c
> +++ b/drivers/dma/idxd/irq.c
> @@ -322,6 +322,7 @@ static void process_evl_entry(struct idxd_device *idxd,
>
> if (status == DSA_COMP_CRA_XLAT || status == DSA_COMP_DRAIN_EVL ||
> status == DSA_COMP_BATCH_EVL_ERR) {
> + struct idxd_wq *wq = idxd->wqs[entry_head->wq_idx];
> struct idxd_evl_fault *fault;
> int ent_size = evl_ent_size(idxd);
>
> @@ -331,10 +332,24 @@ static void process_evl_entry(struct idxd_device *idxd,
> if (!entry_head->rcr && status == DSA_COMP_DRAIN_EVL)
> return;
>
> + /*
> + * The fault worker only does user-context work,
> + * copying the completion record through the wq's
> + * PASID xarray, which is populated by cdev opens
> + * alone. A kernel WQ, or a user WQ whose cdev driver
> + * is not bound, has no cdev workqueue and no user
> + * contexts, so queueing could only warn and drop the
> + * record. Note it and move on.
> + */
> + if (!is_idxd_wq_user(wq) || !wq->wq) {
> + dev_warn_ratelimited(dev,
> + "EVL fault on wq %d with no user fault workqueue (type %u), status %#x\n",
> + wq->id, wq->type, status);
> + return;
> + }
> +
> fault = kmem_cache_alloc(idxd->evl_cache, GFP_ATOMIC);
> if (fault) {
> - struct idxd_wq *wq = idxd->wqs[entry_head->wq_idx];
> -
> fault->wq = wq;
> fault->status = status;
> memcpy(&fault->entry, entry_head, ent_size);
> --
> 2.43.0
>
next prev parent reply other threads:[~2026-12-03 17:47 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20261130194721.1900266-1-daniel1.byrne@intel.com>
2026-11-30 19:47 ` [PATCH v2 01/10] dmaengine: idxd: don't queue EVL fault work for kernel WQs Daniel Byrne
2026-12-03 17:47 ` Frank Li [this message]
2026-11-30 19:47 ` [PATCH v2 02/10] dmaengine: idxd: detach the user fault workqueue under the event log lock Daniel Byrne
2026-12-03 17:47 ` Frank Li
2026-11-30 19:47 ` [PATCH v2 03/10] dmaengine: idxd: free the event log fault item when no record is copied Daniel Byrne
2026-12-03 17:47 ` Frank Li
2026-11-30 19:47 ` [PATCH v2 04/10] dmaengine: idxd: refuse a memcpy longer than the WQ max transfer size Daniel Byrne
2026-12-03 17:48 ` Frank Li
2026-11-30 19:47 ` [PATCH v2 05/10] dmaengine: idxd: take an mm_users reference for the completion record copy Daniel Byrne
2026-12-03 17:49 ` Frank Li
2026-11-30 19:47 ` [PATCH v2 06/10] dmaengine: idxd: read GENCFG before clearing the event log enable Daniel Byrne
2026-12-03 17:49 ` Frank Li
2026-11-30 19:47 ` [PATCH v2 07/10] dmaengine: idxd: don't sleep for a descriptor in the prep callbacks Daniel Byrne
2026-12-03 17:49 ` Frank Li
2026-11-30 19:47 ` [PATCH v2 08/10] dmaengine: idxd: read the event log size under its lock in the setup Daniel Byrne
2026-12-03 17:50 ` Frank Li
2026-11-30 19:47 ` [PATCH v2 09/10] dmaengine: idxd: free the queue interrupt when the percpu_ref setup fails Daniel Byrne
2026-12-03 17:44 ` Frank Li
2026-11-30 19:47 ` [PATCH v2 10/10] dmaengine: idxd: test a queue under its lock before quiescing it Daniel Byrne
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=axGrFlLFIRlSKOCy@SMW015318 \
--to=frank.li@oss.nxp.com \
--cc=Frank.Li@kernel.org \
--cc=daniel1.byrne@intel.com \
--cc=dave.jiang@intel.com \
--cc=djbw@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=fenghuay@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=vinicius.gomes@intel.com \
--cc=vkoul@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox