From: sashiko-bot@kernel.org
To: "Nicolai Buchwitz" <nb@tipi-net.de>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net-next v7 3/7] net: bcmgenet: add basic XDP support (PASS/DROP)
Date: Sat, 25 Apr 2026 01:26:24 +0000 [thread overview]
Message-ID: <20260425012624.DBC50C19425@smtp.kernel.org> (raw)
In-Reply-To: <20260416054743.1289191-4-nb@tipi-net.de>
Sashiko AI review found 1 potential issue(s):
- [High] The driver incorrectly applies the original hardware checksum (`CHECKSUM_COMPLETE`) to the SKB after an XDP program has processed the packet.
--
commit 5fcb56745df8a1527b5006d1089794e51dbc65ee
Author: Nicolai Buchwitz <nb@tipi-net.de>
net: bcmgenet: add basic XDP support (PASS/DROP)
This commit adds basic XDP program attachment via ndo_bpf and executes
XDP programs in the RX path. It handles XDP_PASS by building an SKB from
the xdp_buff, and XDP_DROP by returning the page to the page_pool.
> diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
[ ... ]
> @@ -2404,30 +2462,34 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_rx_ring *ring,
[ ... ]
> + /* Save rx_csum before XDP runs - an XDP program
> + * could overwrite the RSB via bpf_xdp_adjust_head.
> */
> + if (dev->features & NETIF_F_RXCSUM)
> + rx_csum = (__force __be16)(status->rx_csum & 0xffff);
>
> + xdp_init_buff(&xdp, PAGE_SIZE, &ring->xdp_rxq);
> + xdp_prepare_buff(&xdp, page_address(rx_page),
> + GENET_RX_HEADROOM, pkt_len, true);
>
> + xdp_act = bcmgenet_run_xdp(ring, xdp_prog, &xdp, rx_page);
> + if (xdp_act != XDP_PASS)
> + goto next;
>
> + skb = bcmgenet_xdp_build_skb(ring, &xdp);
> + if (unlikely(!skb)) {
> + BCMGENET_STATS64_INC(stats, dropped);
> + page_pool_put_full_page(ring->page_pool,
> + rx_page, true);
> + goto next;
> }
>
> /* Set up checksum offload */
> if (dev->features & NETIF_F_RXCSUM) {
> if (rx_csum) {
> skb->csum = (__force __wsum)ntohs(rx_csum);
> skb->ip_summed = CHECKSUM_COMPLETE;
Does this unconditionally apply the original hardware checksum to the SKB
after the XDP program has executed?
Since XDP programs can modify the packet payload before returning XDP_PASS,
the original hardware sum might no longer be mathematically valid for the
modified packet.
If a modified packet retains CHECKSUM_COMPLETE with the old checksum, could
the network stack rely on it, fail validation, and erroneously drop the
packet?
Would it make sense to invalidate the hardware checksum (for example, by
setting skb->ip_summed to CHECKSUM_NONE) if an XDP program is present and
processes the packet?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260416054743.1289191-1-nb@tipi-net.de?part=3
next prev parent reply other threads:[~2026-04-25 1:26 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-16 5:47 [PATCH net-next v7 0/7] net: bcmgenet: add XDP support Nicolai Buchwitz
2026-04-16 5:47 ` [PATCH net-next v7 2/7] net: bcmgenet: register xdp_rxq_info for each RX ring Nicolai Buchwitz
2026-04-16 5:47 ` [PATCH net-next v7 3/7] net: bcmgenet: add basic XDP support (PASS/DROP) Nicolai Buchwitz
2026-04-25 1:26 ` sashiko-bot [this message]
2026-04-16 5:47 ` [PATCH net-next v7 4/7] net: bcmgenet: add XDP_TX support Nicolai Buchwitz
2026-04-16 18:54 ` sashiko-bot
2026-04-16 5:47 ` [PATCH net-next v7 5/7] net: bcmgenet: add XDP_REDIRECT and ndo_xdp_xmit support Nicolai Buchwitz
2026-04-16 19:46 ` sashiko-bot
2026-04-16 5:47 ` [PATCH net-next v7 6/7] net: bcmgenet: add XDP statistics counters Nicolai Buchwitz
2026-04-16 20:08 ` sashiko-bot
2026-04-16 5:47 ` [PATCH net-next v7 7/7] net: bcmgenet: reject MTU changes incompatible with XDP Nicolai Buchwitz
2026-04-16 20:47 ` sashiko-bot
2026-04-16 8:06 ` [PATCH net-next v7 0/7] net: bcmgenet: add XDP support Paolo Abeni
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=20260425012624.DBC50C19425@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=nb@tipi-net.de \
--cc=sashiko@lists.linux.dev \
/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