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] [day] [month] [year] [list]
Message-ID: <CANn89iKhVL0uQz9eTi6y3iDtQqRvCVt8T7MndxfMGKf7sPLvhw@mail.gmail.com>
Date: Fri, 25 Jul 2025 08:47:34 -0700
From: Eric Dumazet <edumazet@...gle.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: Thomas Fourier <fourier.thomas@...il.com>, Andrew Lunn <andrew+netdev@...n.ch>, 
	"David S. Miller" <davem@...emloft.net>, 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 8:10 AM Jakub Kicinski <kuba@...nel.org> wrote:
>
> On Fri, 25 Jul 2025 06:53:16 -0700 Eric Dumazet wrote:
> > Not sure if this driver is actively used...
>
> Like most of the drivers that are missing dma_mappnig_error() :(

Well, a failure in __netdev_alloc_skb_ip_align() is more probable.

Maybe the following would help (and fix
ndev->stats.rx_packets/ndev->stats.rx_bytes) as well.

diff --git a/drivers/net/ethernet/ni/nixge.c b/drivers/net/ethernet/ni/nixge.c
index 230d5ff99dd7e1e9fabe21a6617d72d663cc1a7c..835463c301e11dca9f824137e75dd0eacf130419
100644
--- a/drivers/net/ethernet/ni/nixge.c
+++ b/drivers/net/ethernet/ni/nixge.c
@@ -606,9 +606,6 @@ static int nixge_recv(struct net_device *ndev, int budget)

        while ((cur_p->status & XAXIDMA_BD_STS_COMPLETE_MASK &&
                budget > packets)) {
-               tail_p = priv->rx_bd_p + sizeof(*priv->rx_bd_v) *
-                        priv->rx_bd_ci;
-
                skb = (struct sk_buff *)(uintptr_t)
                        nixge_hw_dma_bd_get_addr(cur_p, sw_id_offset);

@@ -639,7 +636,7 @@ static int nixge_recv(struct net_device *ndev, int budget)
                new_skb = netdev_alloc_skb_ip_align(ndev,
                                                    NIXGE_MAX_JUMBO_FRAME_SIZE);
                if (!new_skb)
-                       return packets;
+                       goto end;

                cur_phys = dma_map_single(ndev->dev.parent, new_skb->data,
                                          NIXGE_MAX_JUMBO_FRAME_SIZE,
@@ -653,11 +650,15 @@ static int nixge_recv(struct net_device *ndev, int budget)
                cur_p->status = 0;
                nixge_hw_dma_bd_set_offset(cur_p, (uintptr_t)new_skb);

+               tail_p = priv->rx_bd_p + sizeof(*priv->rx_bd_v) *
+                        priv->rx_bd_ci;
+
                ++priv->rx_bd_ci;
                priv->rx_bd_ci %= RX_BD_NUM;
                cur_p = &priv->rx_bd_v[priv->rx_bd_ci];
        }

+end:
        ndev->stats.rx_packets += packets;
        ndev->stats.rx_bytes += size;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ