From: Dave Jiang <dave.jiang@intel.com>
To: Koichiro Den <den@valinux.co.jp>, Jon Mason <jdmason@kudzu.us>,
Allen Hubbe <allenbh@gmail.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: ntb@lists.linux.dev, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net 4/4] NTB: ntb_transport: Reject oversized TX buffers
Date: Wed, 19 Aug 2026 16:47:48 -0700 [thread overview]
Message-ID: <274faae6-fe48-4310-8deb-4b57c5c01f7c@intel.com> (raw)
In-Reply-To: <20260817053519.4135287-5-den@valinux.co.jp>
On 8/16/26 10:35 PM, Koichiro Den wrote:
> ntb_process_tx() handles an oversized buffer by calling tx_handler()
> with a NULL data pointer and returning success. ntb_netdev therefore
> neither frees the skb in its completion callback nor takes its enqueue
> error path, leaking it.
>
> Reject oversized buffers in ntb_transport_tx_enqueue() before acquiring
> a queue entry and return -EMSGSIZE. The caller retains ownership of the
> buffer, and the preceding netdev patch frees the skb when enqueue
> returns this permanent error.
>
> Fixes: fce8a7bb5b4b ("PCI-Express Non-Transparent Bridge Support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Koichiro Den <den@valinux.co.jp>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> ---
> Previously posted at:
> https://lore.kernel.org/r/20260810165136.2292436-3-den@valinux.co.jp/
>
> I moved the fix here because it addresses a pre-existing issue
> independently of that feature series. I also moved the size check before
> the tx_free_q lookup so -EBUSY cannot mask -EMSGSIZE.
> ---
> drivers/ntb/ntb_transport.c | 12 +++---------
> 1 file changed, 3 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
> index 4bdd81edcb87..f9caa1a653c5 100644
> --- a/drivers/ntb/ntb_transport.c
> +++ b/drivers/ntb/ntb_transport.c
> @@ -1955,15 +1955,6 @@ static int ntb_process_tx(struct ntb_transport_qp *qp,
> return -EAGAIN;
> }
>
> - if (entry->len > qp->tx_max_frame - sizeof(struct ntb_payload_header)) {
> - if (qp->tx_handler)
> - qp->tx_handler(qp, qp->cb_data, NULL, -EIO);
> -
> - ntb_list_add(&qp->ntb_tx_free_q_lock, &entry->entry,
> - &qp->tx_free_q);
> - return 0;
> - }
> -
> ntb_async_tx(qp, entry);
>
> qp->tx_pkts++;
> @@ -2356,6 +2347,9 @@ int ntb_transport_tx_enqueue(struct ntb_transport_qp *qp, void *cb, void *data,
> if (!qp->link_is_up)
> return -ENOLINK;
>
> + if (len > qp->tx_max_frame - sizeof(struct ntb_payload_header))
> + return -EMSGSIZE;
> +
> entry = ntb_list_rm(&qp->ntb_tx_free_q_lock, &qp->tx_free_q);
> if (!entry) {
> qp->tx_err_no_buf++;
next prev parent reply other threads:[~2026-08-19 23:47 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-17 5:35 [PATCH net 0/4] net: ntb_netdev: Fix TX completion and error handling Koichiro Den
2026-08-17 5:35 ` [PATCH net 1/4] NTB: ntb_transport: Recycle TX entries before client callbacks Koichiro Den
2026-08-18 5:35 ` sashiko-bot
2026-08-19 21:16 ` Dave Jiang
2026-08-17 5:35 ` [PATCH net 2/4] net: ntb_netdev: Fix TX busy and drop handling Koichiro Den
2026-08-19 23:39 ` Dave Jiang
2026-08-17 5:35 ` [PATCH net 3/4] NTB: ntb_transport: Fail TX enqueue when the QP link is down Koichiro Den
2026-08-18 5:35 ` sashiko-bot
2026-08-19 23:46 ` Dave Jiang
2026-08-17 5:35 ` [PATCH net 4/4] NTB: ntb_transport: Reject oversized TX buffers Koichiro Den
2026-08-18 5:35 ` sashiko-bot
2026-08-19 23:47 ` Dave Jiang [this message]
2026-08-20 21:10 ` [PATCH net 0/4] net: ntb_netdev: Fix TX completion and error handling 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=274faae6-fe48-4310-8deb-4b57c5c01f7c@intel.com \
--to=dave.jiang@intel.com \
--cc=allenbh@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=den@valinux.co.jp \
--cc=edumazet@google.com \
--cc=jdmason@kudzu.us \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=ntb@lists.linux.dev \
--cc=pabeni@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.