lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iJW+4xLsTGU6LU4Y=amciL5Kni=wS1uTKy-wC8pCwNDGQ@mail.gmail.com>
Date: Fri, 25 Jul 2025 06:53:16 -0700
From: Eric Dumazet <edumazet@...gle.com>
To: Thomas Fourier <fourier.thomas@...il.com>
Cc: Andrew Lunn <andrew+netdev@...n.ch>, "David S. Miller" <davem@...emloft.net>, 
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, 
	Uwe Kleine-König <u.kleine-koenig@...libre.com>, 
	Moritz Fischer <mdf@...nel.org>, netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net] net: ethernet: nixge: Add missing check after DMA map

On Fri, Jul 25, 2025 at 6:34 AM Thomas Fourier <fourier.thomas@...il.com> wrote:
>
> The DMA map functions can fail and should be tested for errors.
>
> Fixes: 492caffa8a1a ("net: ethernet: nixge: Add support for National Instruments XGE netdev")
> Signed-off-by: Thomas Fourier <fourier.thomas@...il.com>
> ---
>  drivers/net/ethernet/ni/nixge.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/ni/nixge.c b/drivers/net/ethernet/ni/nixge.c
> index 230d5ff99dd7..027e53023007 100644
> --- a/drivers/net/ethernet/ni/nixge.c
> +++ b/drivers/net/ethernet/ni/nixge.c
> @@ -334,6 +334,10 @@ static int nixge_hw_dma_bd_init(struct net_device *ndev)
>                 phys = dma_map_single(ndev->dev.parent, skb->data,
>                                       NIXGE_MAX_JUMBO_FRAME_SIZE,
>                                       DMA_FROM_DEVICE);
> +               if (dma_mapping_error(ndev->dev.parent, phys)) {
> +                       dev_kfree_skb_any(skb);
> +                       goto out;
> +               }
>
>                 nixge_hw_dma_bd_set_phys(&priv->rx_bd_v[i], phys);
>
> @@ -645,8 +649,8 @@ static int nixge_recv(struct net_device *ndev, int budget)
>                                           NIXGE_MAX_JUMBO_FRAME_SIZE,
>                                           DMA_FROM_DEVICE);
>                 if (dma_mapping_error(ndev->dev.parent, cur_phys)) {
> -                       /* FIXME: bail out and clean up */
> -                       netdev_err(ndev, "Failed to map ...\n");
> +                       dev_kfree_skb_any(new_skb);
> +                       return packets;

Note that this error (and the possible failed
netdev_alloc_skb_ip_align() at line 641) can leave the queue in a
frozen state,
because of a missing

nixge_dma_write_desc_reg(priv, XAXIDMA_RX_TDESC_OFFSET, tail_p);

Not sure if this driver is actively used...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ