DMA Engine development
 help / color / mirror / Atom feed
From: Dave Jiang <dave.jiang@intel.com>
To: Vinicius Costa Gomes <vinicius.gomes@intel.com>,
	Vinod Koul <vkoul@kernel.org>, Frank Li <Frank.Li@kernel.org>,
	Fenghua Yu <fenghuay@nvidia.com>,
	Shuai Xue <xueshuai@linux.alibaba.com>
Cc: dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 6/8] dmaengine: idxd: Initialize the WQ XArray before the WQ can be released
Date: Mon, 30 Nov 2026 10:14:16 -0700	[thread overview]
Message-ID: <31a42eca-2af2-4b57-8822-120ec3f89bda@intel.com> (raw)
In-Reply-To: <20261125-wt-idxd-fixes-v2-6-25a4691dfb9e@intel.com>



On 11/25/26 4:49 PM, Vinicius Costa Gomes wrote:
> idxd_setup_wqs() initializes wq->upasid_xa and wq->uc_lock last. Its
> error paths call put_device() on the WQ device before that, and the
> release callback, idxd_conf_wq_release(), calls xa_destroy() on the
> uninitialized XArray.
> 
> Initialize both before device_initialize().
> 
> Fixes: b022f59725f0 ("dmaengine: idxd: add idxd_copy_cr() to copy user completion record during page fault handling")
> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>

Reviewed-by: Dave Jiang <dave.jiang@intel.com>

> ---
>  drivers/dma/idxd/init.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/idxd/init.c b/drivers/dma/idxd/init.c
> index 9cfb165a1569..e5b797c0ffef 100644
> --- a/drivers/dma/idxd/init.c
> +++ b/drivers/dma/idxd/init.c
> @@ -197,6 +197,8 @@ static int idxd_setup_wqs(struct idxd_device *idxd)
>  		conf_dev = wq_confdev(wq);
>  		wq->id = i;
>  		wq->idxd = idxd;
> +		mutex_init(&wq->uc_lock);
> +		xa_init(&wq->upasid_xa);
>  		device_initialize(conf_dev);
>  		conf_dev->parent = idxd_confdev(idxd);
>  		conf_dev->bus = &dsa_bus_type;
> @@ -231,8 +233,6 @@ static int idxd_setup_wqs(struct idxd_device *idxd)
>  			}
>  			bitmap_copy(wq->opcap_bmap, idxd->opcap_bmap, IDXD_MAX_OPCAP_BITS);
>  		}
> -		mutex_init(&wq->uc_lock);
> -		xa_init(&wq->upasid_xa);
>  		idxd->wqs[i] = wq;
>  	}
>  
> 


  reply	other threads:[~2026-11-30 17:14 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 23:48 [PATCH v2 0/8] dmaengine: idxd: More error handling fixes Vinicius Costa Gomes
2026-11-25 23:48 ` [PATCH v2 1/8] dmaengine: idxd: Do not call destroy_workqueue() with null idxd->wq Vinicius Costa Gomes
2026-11-25 23:49 ` [PATCH v2 2/8] dmaengine: idxd: Fix potential double free on probe error path Vinicius Costa Gomes
2026-11-25 23:49 ` [PATCH v2 3/8] dmaengine: idxd: fix duplicate memory frees on initialization " Vinicius Costa Gomes
2026-11-25 23:49 ` [PATCH v2 4/8] dmaengine: idxd: Fix the device registration error paths Vinicius Costa Gomes
2026-11-30 17:03   ` Dave Jiang
2026-11-25 23:49 ` [PATCH v2 5/8] dmaengine: idxd: Fix error handling in idxd_cdev_open() Vinicius Costa Gomes
2026-11-30 17:13   ` Dave Jiang
2026-11-25 23:49 ` [PATCH v2 6/8] dmaengine: idxd: Initialize the WQ XArray before the WQ can be released Vinicius Costa Gomes
2026-11-30 17:14   ` Dave Jiang [this message]
2026-11-25 23:49 ` [PATCH v2 7/8] dmaengine: idxd: Do not release interrupt handles on terminate_all() Vinicius Costa Gomes
2026-11-30 17:15   ` Dave Jiang
2026-11-25 23:49 ` [PATCH v2 8/8] dmaengine: idxd: Don't flush the descriptors " Vinicius Costa Gomes
2026-11-26  0:19   ` sashiko-bot
2026-11-30 17:18   ` Dave Jiang

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=31a42eca-2af2-4b57-8822-120ec3f89bda@intel.com \
    --to=dave.jiang@intel.com \
    --cc=Frank.Li@kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=fenghuay@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vinicius.gomes@intel.com \
    --cc=vkoul@kernel.org \
    --cc=xueshuai@linux.alibaba.com \
    /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