From: sashiko-bot@kernel.org
To: "Koichiro Den" <den@valinux.co.jp>
Cc: ntb@lists.linux.dev
Subject: Re: [PATCH net-next v2 4/4] net: ntb_netdev: Preserve CHECKSUM_PARTIAL across NTB
Date: Tue, 18 Aug 2026 06:49:52 +0000 [thread overview]
Message-ID: <20260818064952.A489D1F00A3E@smtp.kernel.org> (raw)
In-Reply-To: <20260817064916.13278-5-den@valinux.co.jp>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Pre-existing memory leak of `skb` when transmitting while the NTB link is down.
--
--- Patch [4]: [PATCH net-next v2 4/4] net: ntb_netdev: Preserve CHECKSUM_PARTIAL across NTB ---
commit 52574632d1af60a032a3fbef27bc73eb5ad8f90c
Author: Koichiro Den <den@valinux.co.jp>
net: ntb_netdev: Preserve CHECKSUM_PARTIAL across NTB
This commit carries CHECKSUM_PARTIAL with csum_start and csum_offset across
the NTB link to offload checksum calculations to the peer. It advertises
support in every frame and falls back to software until the peer capability
is seen.
> diff --git a/drivers/net/ntb_netdev.c b/drivers/net/ntb_netdev.c
> index 5c7fe6883cb93..9cfb463e472c3 100644
> --- a/drivers/net/ntb_netdev.c
> +++ b/drivers/net/ntb_netdev.c
[ ... ]
> @@ -249,6 +288,7 @@ static const struct ntb_queue_handlers ntb_netdev_handlers = {
> static netdev_tx_t ntb_netdev_start_xmit(struct sk_buff *skb,
> struct net_device *ndev)
> {
> + unsigned int meta = NTB_NETDEV_META_CAP_CSUM;
[ ... ]
> - rc = ntb_transport_tx_enqueue(q->qp, skb, skb->data, skb->len, 0);
> + if (skb->ip_summed == CHECKSUM_PARTIAL) {
> + if (READ_ONCE(dev->peer_csum))
> + meta |= NTB_NETDEV_META_CSUM |
> + (skb_checksum_start_offset(skb) <<
> + NTB_NETDEV_META_CSUM_START_SHIFT) |
> + skb->csum_offset;
> + else if (skb_checksum_help(skb))
> + goto drop;
> + }
> +
> + rc = ntb_transport_tx_enqueue(q->qp, skb, skb->data, skb->len, meta);
[Severity: High]
This is a pre-existing issue, but does this code leak the skb when the NTB
link is down?
Looking at ntb_transport_tx_enqueue() in drivers/ntb/ntb_transport.c, if the
link is down, it returns 0 without taking ownership of the buffer:
drivers/ntb/ntb_transport.c:ntb_transport_tx_enqueue() {
...
/* If the qp link is down already, just ignore. */
if (!qp->link_is_up)
return 0;
...
}
Since ntb_netdev_start_xmit() sees a return code of 0, it assumes successful
queuing and returns NETDEV_TX_OK without freeing the skb. Because the driver
accepts packets from the networking stack regardless of the physical link
state, sending packets while the link is disconnected appears to cause an
unbounded memory leak.
> if (rc)
> goto err;
>
> @@ -267,12 +317,29 @@ static netdev_tx_t ntb_netdev_start_xmit(struct sk_buff *skb,
>
> return NETDEV_TX_OK;
>
> +drop:
> + dev_kfree_skb_any(skb);
> + ndev->stats.tx_dropped++;
> + ndev->stats.tx_errors++;
> + return NETDEV_TX_OK;
> +
> err:
> ndev->stats.tx_dropped++;
> ndev->stats.tx_errors++;
> return NETDEV_TX_BUSY;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260817064916.13278-1-den@valinux.co.jp?part=4
next prev parent reply other threads:[~2026-08-18 6:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-17 6:49 [PATCH net-next v2 0/4] net: ntb_netdev: Preserve checksum offload across NTB Koichiro Den
2026-08-17 6:49 ` [PATCH net-next v2 1/4] NTB: ntb_transport: Order RX descriptor reads after completion Koichiro Den
2026-08-18 6:49 ` sashiko-bot
2026-08-17 6:49 ` [PATCH net-next v2 2/4] NTB: ntb_transport: Use little-endian shared fields Koichiro Den
2026-08-18 6:49 ` sashiko-bot
2026-08-17 6:49 ` [PATCH net-next v2 3/4] NTB: ntb_transport: Add per-payload client metadata Koichiro Den
2026-08-18 6:49 ` sashiko-bot
2026-08-17 6:49 ` [PATCH net-next v2 4/4] net: ntb_netdev: Preserve CHECKSUM_PARTIAL across NTB Koichiro Den
2026-08-18 6:49 ` sashiko-bot [this message]
2026-08-17 15:39 ` [PATCH net-next v2 0/4] net: ntb_netdev: Preserve checksum offload " Jakub Kicinski
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=20260818064952.A489D1F00A3E@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=den@valinux.co.jp \
--cc=ntb@lists.linux.dev \
--cc=sashiko-reviews@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