From: netdev-bot+sashiko@kernel.org
To: mengyuanlou@net-swift.com
Cc: netdev@vger.kernel.org, jiawenwu@trustnetic.com,
duanqiangwen@net-swift.com, linglingzhang@net-swift.com,
andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, hramamurthy@google.com,
jacob.e.keller@intel.com, przemyslaw.kitszel@intel.com
Subject: Re: [PATCH net v8 1/2] net: wangxun: protect ring accesses with RCU
Date: Sun, 22 Nov 2026 08:33:45 +0000 [thread overview]
Message-ID: <179533642599.3135.8576432289828139956@kernel.org> (raw)
In-Reply-To: <20261118081329.39551-2-mengyuanlou@net-swift.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 0 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [High] The commit message describes VF suspend/resume changes that are
not in the patch, and relies on them to argue that the new __rcu /…
--
net: wangxun: protect ring accesses with RCU
This commit marks wx->tx_ring[] and wx->rx_ring[] as __rcu. Readers are
converted to rcu_dereference() or rtnl_dereference(). The reg_idx
computation moves into per-ring allocation via wx_get_reg_idx(), and
wx_xmit_frame() gains checks for a NULL ring or zero queue count during
teardown.
> The ring arrays are managed by wx_alloc_q_vector() and
> wx_free_q_vector(), reached through wx_init_interrupt_scheme() and
> wx_clear_interrupt_scheme(). The probe paths call
> wx_init_interrupt_scheme() before the netdev is registered; the
> allocation path only publishes rings with rcu_assign_pointer(), so no
> RTNL is needed there. wxvf_resume() defers rebuilding the interrupt
> scheme to wxvf_reopen_subtask(), which runs under RTNL. wxvf_suspend()
> holds RTNL across wxvf_close() and wx_clear_interrupt_scheme(),
> protecting control-path readers and serializing teardown against the
> reset subtask. The service timer and work are drained before the PCI
> device is disabled.
[Severity: High]
Is a VF hunk missing from this patch, or does this paragraph describe a
different revision?
The only change to wx_vf_common.c here is the rtnl_dereference()
conversion in wx_configure_rx_vf(). wxvf_reopen_subtask() does not exist
anywhere under drivers/net/ethernet/wangxun/. After this patch,
wxvf_suspend() (which wxvf_shutdown() also calls) and wxvf_resume() still
read:
drivers/net/ethernet/wangxun/libwx/wx_vf_common.c:wxvf_suspend() {
netif_device_detach(wx->netdev);
wx_clear_interrupt_scheme(wx);
pci_disable_device(pdev);
}
drivers/net/ethernet/wangxun/libwx/wx_vf_common.c:wxvf_resume() {
pci_set_master(pdev);
wx_init_interrupt_scheme(wx);
netif_device_attach(wx->netdev);
}
So wxvf_suspend() takes no RTNL and does not call wxvf_close() on a
running interface. It also does not set WX_STATE_DOWN and does not cancel
service_timer or service_task.
The new comment in struct wx says:
Control-path readers use rtnl_dereference() while holding RTNL.
That only works if the writers in wx_free_q_vector() also hold RTNL. On
this path, wx_free_q_vectors() zeroes the queue counts, NULLs each slot,
and calls kfree_rcu() on the q_vector that embeds the rings, all without
RTNL.
Can the service task race with this? Suspend leaves the timer armed and
WX_STATE_DOWN clear, so the check in wxvf_reset_subtask() still passes:
wxvf_service_task()
wxvf_reset_subtask()
rtnl_lock()
wxvf_reinit_locked()
wxvf_down()
wx_clean_all_tx_rings()
wx_clean_all_rx_rings()
wx_configure_vf()
wx_configure_tx_vf()
wx_configure_rx_vf()
wx_set_ringparam_vf() is another example:
rtnl_dereference(wx->tx_ring[i])->count = new_tx_count;
None of these readers check for NULL or run inside an RCU read-side
section, and some of them sleep, e.g. read_poll_timeout(). Could they
dereference a NULL ring, or use a ring after its kfree_rcu() grace period
has ended?
On resume, wx_init_interrupt_scheme() publishes new zeroed rings with
tx_buffer_info == NULL and desc == NULL, and sets WX_STATE_DOWN. Nothing
reopens the device after that. netif_device_attach() then wakes the TX
queues of a netdev that is still running, and its carrier was never
turned off.
The new checks in wx_xmit_frame() pass, because num_tx_queues is non-zero
and the ring is non-NULL. Does wx_xmit_frame_ring() then dereference a
NULL tx_buffer_info here?
first = &tx_ring->tx_buffer_info[tx_ring->next_to_use];
first->skb = skb;
Because suspend skips wxvf_close(), the queue and misc IRQs are not freed
before pci_free_irq_vectors(). NAPI instances that are still enabled are
passed to netif_napi_del(). The descriptor DMA memory, the buffer_info
arrays and the page_pool are reachable only through the rings freed by
kfree_rcu(). Do these leak on every suspend or shutdown with the
interface up?
Much of this VF lifecycle behaviour predates the patch. However, the
commit message depends on the RTNL, close, drain and reopen changes to
justify the rtnl_dereference() locking model, and those changes are not
in the patch. Could the missing VF changes be included, or could the
commit message and the struct wx comment be corrected to match the
locking the code actually has?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261118081329.39551-1-mengyuanlou%40net-swift.com
next prev parent reply other threads:[~2026-11-22 8:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 8:13 [PATCH net v8 0/2] net: wangxun: protect ring accesses with RCU Mengyuan Lou
2026-11-18 8:13 ` [PATCH net v8 1/2] " Mengyuan Lou
2026-11-22 8:33 ` netdev-bot+sashiko [this message]
2026-11-18 8:13 ` [PATCH net v8 2/2] net: wangxun: access queue counts consistently Mengyuan Lou
2026-11-18 8:18 ` [PATCH net v8 0/2] net: wangxun: protect ring accesses with RCU netdev-bot+sinfo
2026-11-18 9:29 ` mengyuanlou
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=179533642599.3135.8576432289828139956@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=duanqiangwen@net-swift.com \
--cc=edumazet@google.com \
--cc=hramamurthy@google.com \
--cc=jacob.e.keller@intel.com \
--cc=jiawenwu@trustnetic.com \
--cc=kuba@kernel.org \
--cc=linglingzhang@net-swift.com \
--cc=mengyuanlou@net-swift.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.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