From: Jakub Kicinski <kuba@kernel.org>
To: Adriano Vero <litaliano00.contact@gmail.com>
Cc: michael.chan@broadcom.com, davem@davemloft.net,
edumazet@google.com, pabeni@redhat.com, netdev@vger.kernel.org
Subject: Re: [PATCH] net: broadcom: b44: Add missing dma_mapping_error in b44_start_xmit
Date: Mon, 23 Mar 2026 14:23:40 -0700 [thread overview]
Message-ID: <20260323142340.13fded29@kernel.org> (raw)
In-Reply-To: <20260323180913.188434-1-litaliano00.contact@gmail.com>
On Mon, 23 Mar 2026 19:09:13 +0100 Adriano Vero wrote:
> The b44 driver calls dma_map_single() in the transmit path but fails to
> check the return value for errors using dma_mapping_error().
You say it doesn't use dma_mapping_error() ..
> If the DMA
> mapping fails under memory pressure, it can lead to memory corruption.
>
> Add the missing check, drop the skb, and return NETDEV_TX_OK to prevent
> ring corruption.
> --- a/drivers/net/ethernet/broadcom/b44.c
> +++ b/drivers/net/ethernet/broadcom/b44.c
> @@ -964,8 +964,14 @@ static netdev_tx_t b44_start_xmit(struct sk_buff *skb, struct net_device *dev)
> }
>
> mapping = dma_map_single(bp->sdev->dma_dev, skb->data, len, DMA_TO_DEVICE);
> - if (dma_mapping_error(bp->sdev->dma_dev, mapping) || mapping + len > DMA_BIT_MASK(30)) {
.. and yet this line clearly contains the check.
Please explain what you mean and do not post a v2 until some reviewer
requests that you do so.
> - struct sk_buff *bounce_skb;
> +
> + if (dma_mapping_error(bp->sdev->dma_dev, mapping)) {
> + dev_kfree_skb_any(skb);
> + return NETDEV_TX_OK;
> + }
> +
> + if (mapping + len > DMA_BIT_MASK(30)) {
> + struct sk_buff *bounce_skb;
>
> /* Chip can't handle DMA to/from >1GB, use bounce buffer */
> if (!dma_mapping_error(bp->sdev->dma_dev, mapping))
prev parent reply other threads:[~2026-03-23 21:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-23 18:09 [PATCH] net: broadcom: b44: Add missing dma_mapping_error in b44_start_xmit Adriano Vero
2026-03-23 21:23 ` Jakub Kicinski [this message]
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=20260323142340.13fded29@kernel.org \
--to=kuba@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=litaliano00.contact@gmail.com \
--cc=michael.chan@broadcom.com \
--cc=netdev@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox