From: sashiko-bot@kernel.org
To: "Koichiro Den" <den@valinux.co.jp>
Cc: ntb@lists.linux.dev
Subject: Re: [PATCH net-next v3 3/4] NTB: ntb_transport: Add per-payload client metadata
Date: Sat, 05 Sep 2026 05:22:01 +0000 [thread overview]
Message-ID: <20260905052202.4C24D1F00A3F@smtp.kernel.org> (raw)
In-Reply-To: <20260904052134.2970111-4-den@valinux.co.jp>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Unaligned frame sizes lead to unaligned I/O writes and memory reads of the payload header.
--
commit 91aff7efee260ec323eefdc5885fbc094f6643c8
Author: Koichiro Den <den@valinux.co.jp>
NTB: ntb_transport: Add per-payload client metadata
This commit extends ntb_transport to carry 24 bits of opaque client metadata
alongside payload bytes. The metadata is packed into the upper bits of the
payload header's flags field and exposed via the transmit and receive
interfaces. It also adapts ntb_netdev to use the new interfaces without
metadata.
> diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
> index 3f497a62673fd..197376376bff5 100644
> --- a/drivers/ntb/ntb_transport.c
> +++ b/drivers/ntb/ntb_transport.c
[ ... ]
> @@ -1656,6 +1662,7 @@ static int ntb_process_rxc(struct ntb_transport_qp *qp)
>
> entry->rx_hdr = hdr;
> entry->rx_index = qp->rx_index;
> + entry->flags = flags & DESC_META_MASK;
[Severity: High]
This is a pre-existing issue, but does the calculation of the frame sizes
guarantee 4-byte alignment for the payload header?
In ntb_transport_setup_qp_mw(), qp->rx_max_frame and qp->tx_max_frame are
calculated using rx_size / 2 and tx_size / 2 without forcing alignment.
This means the hdr pointer in ntb_process_rxc() can be unaligned when
reading flags:
drivers/ntb/ntb_transport.c:ntb_process_rxc() {
...
offset = qp->rx_buff + qp->rx_max_frame * qp->rx_index;
hdr = offset + qp->rx_max_frame - sizeof(struct ntb_payload_header);
flags = le32_to_cpu(READ_ONCE(hdr->flags));
...
}
Executing READ_ONCE() on an unaligned address can trigger alignment faults
(kernel panics) depending on the architecture.
Additionally, this unaligned frame size also leads to unaligned 32-bit PCIe
I/O writes in ntb_async_tx():
drivers/ntb/ntb_transport.c:ntb_async_tx() {
...
iowrite32(entry->len, &hdr->len);
...
}
Unaligned memory-mapped PCIe addresses can trigger fatal hardware errors
(Unsupported Request). Can we ensure qp->rx_max_frame and qp->tx_max_frame
are properly aligned?
>
> if (len > entry->len) {
> dev_dbg(&qp->ndev->pdev->dev,
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260904052134.2970111-1-den@valinux.co.jp?part=3
next prev parent reply other threads:[~2026-09-05 5:22 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-04 5:21 [PATCH net-next v3 0/4] net: ntb_netdev: Preserve checksum offload across NTB Koichiro Den
2026-09-04 5:21 ` [PATCH net-next v3 1/4] NTB: ntb_transport: Order RX descriptor reads after completion Koichiro Den
2026-09-05 5:22 ` sashiko-bot
2026-09-04 5:21 ` [PATCH net-next v3 2/4] NTB: ntb_transport: Use little-endian shared fields Koichiro Den
2026-09-05 5:22 ` sashiko-bot
2026-09-04 5:21 ` [PATCH net-next v3 3/4] NTB: ntb_transport: Add per-payload client metadata Koichiro Den
2026-09-05 5:22 ` sashiko-bot [this message]
2026-09-09 20:24 ` netdev-bot+sashiko
2026-09-11 0:18 ` Jakub Kicinski
2026-09-11 7:48 ` Koichiro Den
2026-09-04 5:21 ` [PATCH net-next v3 4/4] net: ntb_netdev: Preserve CHECKSUM_PARTIAL across NTB Koichiro Den
2026-09-09 20:24 ` netdev-bot+sashiko
2026-09-11 5:49 ` Koichiro Den
2026-09-11 0:20 ` Jakub Kicinski
2026-09-11 5:41 ` Koichiro Den
2026-09-11 9:47 ` 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=20260905052202.4C24D1F00A3F@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