From: Vinicius Costa Gomes <vinicius.gomes@intel.com>
To: Yao Kai <yaokai34@huawei.com>, Vinod Koul <vkoul@kernel.org>
Cc: Dave Jiang <dave.jiang@intel.com>, Frank Li <Frank.Li@kernel.org>,
linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org,
liuyongqiang13@huawei.com, Yao Kai <yaokai34@huawei.com>,
stable@vger.kernel.org
Subject: Re: [PATCH] dmaengine: idxd: Avoid destroying the device workqueue twice
Date: Wed, 25 Nov 2026 16:09:44 -0800 [thread overview]
Message-ID: <87v75ksbav.fsf@intel.com> (raw)
In-Reply-To: <20261111021026.3354620-1-yaokai34@huawei.com>
Hi,
Yao Kai <yaokai34@huawei.com> writes:
> If idxd_probe() fails after idxd_setup_internals() succeeds,
> idxd_cleanup_internals() destroys idxd->wq. The PCI probe error path
> then calls idxd_free(), whose put_device() invokes
> idxd_conf_device_release() and destroys the same workqueue again.
> The err_evl path in idxd_setup_internals() has the same problem.
> This can corrupt the workqueue list or access freed memory.
>
> Clear idxd->wq after both error-path destroy_workqueue() calls and
> only destroy a non-NULL workqueue in the release callback. The NULL
> check also handles failures before the workqueue is created, while
> preserving its destruction on normal device removal.
>
> Fixes: 3d33de353b1f ("dmaengine: idxd: Fix not releasing workqueue on .release()")
> Cc: stable@vger.kernel.org
> Signed-off-by: Yao Kai <yaokai34@huawei.com>
> ---
I just sent v2 of the idxd-fixes series [1]. Setting ->wq to NULL
doesn't fix the double frees of ->wqs, ->engines, ->groups (and
friends) on the same error paths. My approach was a bit more general:
remove the early frees and the early destroy_workqueue(), and rely on
the kobject .release callback to free everything.
But if folks prefer this approach, I would gladly rebase my series on
top of this one.
https://lore.kernel.org/all/20261125-wt-idxd-fixes-v2-0-25a4691dfb9e@intel.com/
Cheers,
--
Vinicius
prev parent reply other threads:[~2026-11-26 0:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 2:10 [PATCH] dmaengine: idxd: Avoid destroying the device workqueue twice Yao Kai
2026-11-11 2:43 ` sashiko-bot
2026-11-12 15:06 ` Dave Jiang
2026-11-17 18:07 ` Frank Li
2026-11-26 0:09 ` Vinicius Costa Gomes [this message]
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=87v75ksbav.fsf@intel.com \
--to=vinicius.gomes@intel.com \
--cc=Frank.Li@kernel.org \
--cc=dave.jiang@intel.com \
--cc=dmaengine@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liuyongqiang13@huawei.com \
--cc=stable@vger.kernel.org \
--cc=vkoul@kernel.org \
--cc=yaokai34@huawei.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 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.