From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Yizhou Zhao <zhaoyz24@mails.tsinghua.edu.cn>,
Yuxiang Yang <yangyx22@mails.tsinghua.edu.cn>,
Ao Wang <wangao@seu.edu.cn>, Xuewei Feng <fengxw06@126.com>,
Qi Li <qli01@tsinghua.edu.cn>, Ke Xu <xuke@tsinghua.edu.cn>,
Dominique Martinet <asmadeus@codewreck.org>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH 7.3.y] 9p/xen: drain response work after unbinding IRQ
Date: Wed, 11 Nov 2026 18:24:40 -0500 [thread overview]
Message-ID: <20261111232430.405441-1-sashal@kernel.org> (raw)
In-Reply-To: <20261109200054-failed-7.3-7b6f2e3c29fb@kernel.org>
From: Yizhou Zhao <zhaoyz24@mails.tsinghua.edu.cn>
[ Upstream commit 7b6f2e3c29fb4d76f1e4973280792eabbd526602 ]
commit ea4f1009408e ("9p/xen : Fix use after free bug in
xen_9pfs_front_remove due to race condition") added cancel_work_sync()
to keep xen_9pfs_front_free() from freeing a ring while
p9_xen_response() is still running.
The work is currently drained before the event channel IRQ is unbound.
That leaves a race window where xen_9pfs_front_event_handler() can run
after cancel_work_sync() returns and queue p9_xen_response() again. The
following unbind_from_irqhandler() synchronizes with the IRQ handler, but
it does not cancel work that the handler already queued. The teardown
can then free the ring and private data while the response work remains
pending, and the worker later dereferences ring->priv and priv->client.
Unbind the event channel IRQ before draining the work. Once the IRQ is
unbound, no new response work can be queued by the backend event channel,
and cancel_work_sync() waits for any work that was queued before or
during the unbind. It is then safe to release the ring resources.
Fixes: ea4f1009408e ("9p/xen : Fix use after free bug in xen_9pfs_front_remove due to race condition")
Cc: stable@vger.kernel.org
Reported-by: Yizhou Zhao <zhaoyz24@mails.tsinghua.edu.cn>
Reported-by: Yuxiang Yang <yangyx22@mails.tsinghua.edu.cn>
Reported-by: Ao Wang <wangao@seu.edu.cn>
Reported-by: Xuewei Feng <fengxw06@126.com>
Reported-by: Qi Li <qli01@tsinghua.edu.cn>
Reported-by: Ke Xu <xuke@tsinghua.edu.cn>
Assisted-by: GLM:GLM-5.1
Signed-off-by: Yizhou Zhao <zhaoyz24@mails.tsinghua.edu.cn>
Message-ID: <20260609155202.1706-1-zhaoyz24@mails.tsinghua.edu.cn>
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
[ sashal: Adjusted indentation to fit the existing if (priv->rings) cleanup wrapper for separately allocated rings. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/9p/trans_xen.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/9p/trans_xen.c b/net/9p/trans_xen.c
index 71a4d276321e2..69a5129a9b64a 100644
--- a/net/9p/trans_xen.c
+++ b/net/9p/trans_xen.c
@@ -291,14 +291,14 @@ static void xen_9pfs_front_free(struct xen_9pfs_front_priv *priv)
for (i = 0; i < XEN_9PFS_NUM_RINGS; i++) {
struct xen_9pfs_dataring *ring = &priv->rings[i];
- cancel_work_sync(&ring->work);
-
if (!ring->intf)
break;
if (ring->irq >= 0) {
unbind_from_irqhandler(ring->irq, ring);
ring->irq = -1;
}
+ cancel_work_sync(&ring->work);
+
if (ring->data.in) {
for (j = 0; j < (1 << ring->intf->ring_order);
j++) {
--
2.53.0
prev parent reply other threads:[~2026-11-11 23:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 1:00 FAILED: patch "[PATCH] 9p/xen: drain response work after unbinding IRQ" failed to apply to 7.3-stable tree Sasha Levin
2026-11-11 23:24 ` Sasha Levin [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=20261111232430.405441-1-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=asmadeus@codewreck.org \
--cc=fengxw06@126.com \
--cc=qli01@tsinghua.edu.cn \
--cc=stable@vger.kernel.org \
--cc=wangao@seu.edu.cn \
--cc=xuke@tsinghua.edu.cn \
--cc=yangyx22@mails.tsinghua.edu.cn \
--cc=zhaoyz24@mails.tsinghua.edu.cn \
/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