From: sashiko-bot@kernel.org
To: "Wei Fang" <wei.fang@nxp.com>
Cc: imx@lists.linux.dev, Frank.Li@kernel.org
Subject: Re: [PATCH v2 net-next 09/12] net: enetc: add CBDR setup/teardown hooks to enetc_si_ops for VF support
Date: Sat, 30 May 2026 00:46:29 +0000 [thread overview]
Message-ID: <20260530004630.253131F00898@smtp.kernel.org> (raw)
In-Reply-To: <20260522092438.1264020-10-wei.fang@nxp.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Missing PCIe posted write flush during CBDR teardown leads to potential DMA use-after-free/fault
--
commit e8719566bfcc671815aca75ea6a2c0caefb79aef
Author: Wei Fang <wei.fang@nxp.com>
net: enetc: add CBDR setup/teardown hooks to enetc_si_ops for VF support
This commit adds setup_cbdr and teardown_cbdr function pointers to struct
enetc_si_ops to allow the ENETC v1 and v4 VF drivers to register their own
command BD ring implementations. It updates the VF driver to call these
operations through the ops structure instead of invoking the v1 functions
directly, enabling runtime selection based on the hardware version.
> diff --git a/drivers/net/ethernet/freescale/enetc/enetc_vf.c b/drivers/net/ethernet/freescale/enetc/enetc_vf.c
> index e8ad5ad5aba48..9cdb0a4d6bafb 100644
> --- a/drivers/net/ethernet/freescale/enetc/enetc_vf.c
> +++ b/drivers/net/ethernet/freescale/enetc/enetc_vf.c
> @@ -288,6 +288,8 @@ static void enetc_vf_netdev_setup(struct enetc_si *si, struct net_device *ndev,
> static const struct enetc_si_ops enetc_vsi_ops = {
> .get_rss_table = enetc_get_rss_table,
> .set_rss_table = enetc_set_rss_table,
> + .setup_cbdr = enetc_setup_cbdr,
> + .teardown_cbdr = enetc_teardown_cbdr,
[Severity: High]
This is a pre-existing issue, but looking at the implementation of
enetc_teardown_cbdr(), the command ring is disabled by writing 0 to the
Mode Register. Because this write translates to an iowrite32, it is a
posted PCIe write that can be delayed in the interconnect fabric.
The code then frees the DMA memory immediately without reading back from
a device register to flush the posted write, and without polling for a
hardware busy status to clear.
If a previous command timed out and the hardware is still processing it,
or if the posted write is simply delayed, could the device continue
accessing the descriptor ring after the memory is unmapped? This might
result in an IOMMU fault or silent memory corruption if the IOMMU is
disabled.
> };
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260522092438.1264020-1-wei.fang@nxp.com?part=9
next prev parent reply other threads:[~2026-05-30 0:46 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-22 9:24 [PATCH v2 net-next 00/12] net: enetc: Prepare for ENETC v4 VF support Wei Fang
2026-05-22 9:24 ` [PATCH v2 net-next 01/12] net: enetc: use enetc_set_si_hw_addr() for setting MAC address Wei Fang
2026-05-30 0:46 ` sashiko-bot
2026-05-22 9:24 ` [PATCH v2 net-next 02/12] net: enetc: move VF message handlers to enetc_msg.c Wei Fang
2026-05-22 9:24 ` [PATCH v2 net-next 03/12] net: enetc: relocate SR-IOV configuration helper for common PF support Wei Fang
2026-05-22 9:24 ` [PATCH v2 net-next 04/12] net: enetc: integrate enetc_msg.c into enetc-pf-common driver Wei Fang
2026-05-22 9:24 ` [PATCH v2 net-next 05/12] net: enetc: use read_poll_timeout() for VF mailbox polling Wei Fang
2026-05-22 9:24 ` [PATCH v2 net-next 06/12] net: enetc: convert mailbox messages to new formats Wei Fang
2026-05-22 9:24 ` [PATCH v2 net-next 07/12] net: enetc: add VF-PF messaging support for IP minor revision query Wei Fang
2026-05-22 9:24 ` [PATCH v2 net-next 08/12] net: enetc: align v1 CBDR API with v4 for VF driver sharing Wei Fang
2026-05-22 9:24 ` [PATCH v2 net-next 09/12] net: enetc: add CBDR setup/teardown hooks to enetc_si_ops for VF support Wei Fang
2026-05-30 0:46 ` sashiko-bot [this message]
2026-05-22 9:24 ` [PATCH v2 net-next 10/12] net: enetc: add generic helper to initialize SR-IOV resources Wei Fang
2026-05-22 9:24 ` [PATCH v2 net-next 11/12] net: enetc: use MADDR_TYPE for MAC filter array size Wei Fang
2026-05-22 9:24 ` [PATCH v2 net-next 12/12] net: enetc: dynamically allocate rxmsg based on VF count Wei Fang
2026-05-25 2:36 ` Wei Fang
2026-05-30 0:46 ` sashiko-bot
2026-05-26 11:30 ` [PATCH v2 net-next 00/12] net: enetc: Prepare for ENETC v4 VF support patchwork-bot+netdevbpf
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=20260530004630.253131F00898@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=imx@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
--cc=wei.fang@nxp.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