[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <260501e8-9c03-43db-877b-1e88e059b67e@lunn.ch>
Date: Wed, 11 Dec 2024 14:57:58 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Ma Ke <make_ruc2021@....com>
Cc: andrew+netdev@...n.ch, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, shannon.nelson@....com,
sd@...asysnail.net, u.kleine-koenig@...libre.com, mdf@...nel.org,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
stable@...r.kernel.org
Subject: Re: [PATCH] net: ethernet: fix NULL dereference in nixge_recv()
On Wed, Dec 11, 2024 at 04:34:24PM +0800, Ma Ke wrote:
> In function nixge_recv() dereference of NULL pointer priv->rx_bd_v is
> possible for the case of its allocation failure in netdev_priv(ndev).
>
> Move while() loop with priv->rx_bd_v dereference under the check for
> its validity.
>
> Cc: stable@...r.kernel.org
> Fixes: 492caffa8a1a ("net: ethernet: nixge: Add support for National Instruments XGE netdev")
> Signed-off-by: Ma Ke <make_ruc2021@....com>
> ---
> drivers/net/ethernet/ni/nixge.c | 86 ++++++++++++++++-----------------
> 1 file changed, 43 insertions(+), 43 deletions(-)
>
> diff --git a/drivers/net/ethernet/ni/nixge.c b/drivers/net/ethernet/ni/nixge.c
> index 230d5ff99dd7..2935ffd62e2a 100644
> --- a/drivers/net/ethernet/ni/nixge.c
> +++ b/drivers/net/ethernet/ni/nixge.c
> @@ -603,64 +603,64 @@ static int nixge_recv(struct net_device *ndev, int budget)
Is this a hot path function? It appears to be used for every single
packet.
Is it possible to check for allocation failures outside of the hot
path? Is priv->rx_bd_v allocated once during probe? If so, fail the
probe.
Andrew
Powered by blists - more mailing lists