From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
patches@lists.linux.dev, Tu Dinh <ngoc-tu.dinh@vates.tech>
Subject: [PATCH 6.6 0002/3318] xen-netback: Fix XenBus connection failure cleanup
Date: Wed, 18 Nov 2026 15:10:24 +0100 [thread overview]
Message-ID: <20261118150313.672001309@linuxfoundation.org> (raw)
In-Reply-To: <20261118150313.527275416@linuxfoundation.org>
6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tu Dinh <ngoc-tu.dinh@vates.tech>
commit dc6d814562b65813556933dbda1015cef61dabf8 upstream.
xenvif_get_stats and xenvif_get_ethtool_stats capture vif->num_queues
under rcu_read_lock. We need to unpublish vif->num_queues before
synchronize_net to ensure that readers that come afterwards will not
read a non-zero vif->num_queues and attempt to access invalid queues.
This is the same cleanup algorithm as used in backend_disconnect and
added in commit b17075d5c198 ("xen-netback: fix race condition on XenBus
disconnect").
This is XSA-531
Fixes: 5fb756f1bbec ("xen-netback: Fix UAF when reading statistics data")
Signed-off-by: Tu Dinh <ngoc-tu.dinh@vates.tech>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/net/xen-netback/xenbus.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
--- a/drivers/net/xen-netback/xenbus.c
+++ b/drivers/net/xen-netback/xenbus.c
@@ -731,6 +731,7 @@ static void connect(struct backend_info
unsigned int queue_index;
unsigned int requested_num_queues;
struct xenvif_queue *queue;
+ unsigned int num_queues;
/* Check whether the frontend requested multiple queues
* and read the number requested.
@@ -837,14 +838,15 @@ static void connect(struct backend_info
return;
err:
- if (be->vif->num_queues > 0)
+ num_queues = be->vif->num_queues;
+ if (num_queues > 0)
xenvif_disconnect_data(be->vif); /* Clean up existing queues */
+ be->vif->num_queues = 0;
synchronize_net();
- for (queue_index = 0; queue_index < be->vif->num_queues; ++queue_index)
+ for (queue_index = 0; queue_index < num_queues; ++queue_index)
xenvif_deinit_queue(&be->vif->queues[queue_index]);
vfree(be->vif->queues);
be->vif->queues = NULL;
- be->vif->num_queues = 0;
xenvif_disconnect_ctrl(be->vif);
return;
}
prev parent reply other threads:[~2026-11-18 15:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 14:10 [PATCH 6.6 0000/3318] 6.6.163-rc1 review Greg Kroah-Hartman
2026-11-18 14:10 ` [PATCH 6.6 0001/3318] x86/bugs: Mitigate TSA on AMD Zen5 Greg Kroah-Hartman
2026-11-18 14:10 ` Greg Kroah-Hartman [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=20261118150313.672001309@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=ngoc-tu.dinh@vates.tech \
--cc=patches@lists.linux.dev \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox