From: sashiko-bot@kernel.org
To: "Daniel Zahka" <daniel.zahka@gmail.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net-next 6/8] eth: mpnic: add a netdevice and basic Tx handling
Date: Thu, 24 Sep 2026 01:44:34 +0000 [thread overview]
Message-ID: <20260924014435.3454D1F00899@smtp.kernel.org> (raw)
In-Reply-To: <20260922-linux-mpnic-v1-6-236844f53072@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] net: mpnic: invalid dma_map_single() with size 0 for completely paged SKBs
--
commit 8d7cf250060d2193a80aa7f55598e2da19bf8165
Author: Daniel Zahka <daniel.zahka@gmail.com>
eth: mpnic: add a netdevice and basic Tx handling
This commit registers the mpnic network interface and implements basic
transmit handling, including doorbell logic and descriptor mapping.
> diff --git a/drivers/net/ethernet/meta/mpnic/mpnic_txrx.c b/drivers/net/ethernet/meta/mpnic/mpnic_txrx.c
> index cb4d1427434c9..f4ad8caf6ce66 100644
> --- a/drivers/net/ethernet/meta/mpnic/mpnic_txrx.c
> +++ b/drivers/net/ethernet/meta/mpnic/mpnic_txrx.c
[ ... ]
> @@ -67,6 +92,138 @@ static void mpnic_unmap_page_twd(struct device *dev, __le64 *twd)
> FIELD_GET(MPNIC_TWD_LEN, raw_twd), DMA_TO_DEVICE);
> }
>
> +static bool
> +mpnic_tx_map(struct mpnic_ring *ring, struct sk_buff *skb, __le64 *meta)
> +{
> + struct device *dev = skb->dev->dev.parent;
> + unsigned int tail = ring->tail, first;
> + unsigned int size, data_len;
> + skb_frag_t *frag;
> + dma_addr_t dma;
> + __le64 *twd;
> +
> + tail++;
> + tail &= ring->size_mask;
> + first = tail;
> +
> + size = skb_headlen(skb);
> + data_len = skb->data_len;
> +
> + if (size > FIELD_MAX(MPNIC_TWD_LEN))
> + goto err_dma;
> +
> + dma = dma_map_single(dev, skb->data, size, DMA_TO_DEVICE);
[Severity: High]
Does this code map a zero-length region if the skb is completely paged?
If a completely paged skb is transmitted (for example, from an af_packet
socket) where the total length is large enough to bypass padding but
skb_headlen(skb) is 0, size will be 0 here.
Calling dma_map_single() with a size of 0 violates the DMA API contract and
triggers a WARN_ON_ONCE. It also submits a 0-length data descriptor to the
device, which might stall the transmit queue or crash the firmware.
> +
> + for (frag = &skb_shinfo(skb)->frags[0];; frag++) {
> + twd = &ring->desc[tail];
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260922-linux-mpnic-v1-0-236844f53072@gmail.com?part=6
next prev parent reply other threads:[~2026-09-24 1:44 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-23 1:43 [PATCH net-next 0/8] eth: mpnic: initial support for Meta Platforms NIC Daniel Zahka
2026-09-23 1:43 ` [PATCH net-next 1/8] eth: mpnic: add scaffolding " Daniel Zahka
2026-09-24 1:44 ` sashiko-bot
2026-09-23 1:43 ` [PATCH net-next 2/8] eth: mpnic: add register init for the device Daniel Zahka
2026-09-24 1:44 ` sashiko-bot
2026-09-24 2:05 ` netdev-bot+sashiko
2026-09-24 16:16 ` Daniel Zahka
2026-09-24 16:22 ` Jakub Kicinski
2026-09-23 1:43 ` [PATCH net-next 3/8] eth: mpnic: allocate MSI-X vectors Daniel Zahka
2026-09-23 1:43 ` [PATCH net-next 4/8] eth: mpnic: implement Tx queue allocation and cleanup Daniel Zahka
2026-09-24 1:44 ` sashiko-bot
2026-09-24 2:05 ` netdev-bot+sashiko
2026-09-24 16:39 ` Daniel Zahka
2026-09-23 1:43 ` [PATCH net-next 5/8] eth: mpnic: start and stop the Tx HW queues Daniel Zahka
2026-09-24 1:44 ` sashiko-bot
2026-09-24 2:05 ` netdev-bot+sashiko
2026-09-24 17:49 ` Daniel Zahka
2026-09-23 1:43 ` [PATCH net-next 6/8] eth: mpnic: add a netdevice and basic Tx handling Daniel Zahka
2026-09-24 1:44 ` sashiko-bot [this message]
2026-09-24 2:05 ` netdev-bot+sashiko
2026-09-24 18:08 ` Daniel Zahka
2026-09-23 1:43 ` [PATCH net-next 7/8] eth: mpnic: implement Rx queue allocation and cleanup Daniel Zahka
2026-09-24 2:05 ` netdev-bot+sashiko
2026-09-24 18:23 ` Daniel Zahka
2026-09-23 1:43 ` [PATCH net-next 8/8] eth: mpnic: add basic Rx handling Daniel Zahka
2026-09-24 1:44 ` sashiko-bot
2026-09-24 2:05 ` netdev-bot+sashiko
2026-09-24 18:38 ` Daniel Zahka
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=20260924014435.3454D1F00899@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel.zahka@gmail.com \
--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