[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a56546ee-87a1-f13d-8b2f-25497828f299@gmail.com>
Date: Thu, 29 Apr 2021 15:22:06 +0100
From: Edward Cree <ecree.xilinx@...il.com>
To: Ignat Korchagin <ignat@...udflare.com>, habetsm.xilinx@...il.com,
davem@...emloft.net, kuba@...nel.org, netdev@...r.kernel.org
Cc: kernel-team@...udflare.com, stable@...r.kernel.org
Subject: Re: [PATCH] sfc: adjust efx->xdp_tx_queue_count with the real number
of initialized queues
On 27/04/2021 22:09, Ignat Korchagin wrote:
> efx->xdp_tx_queue_count is initially initialized to num_possible_cpus() and is
> later used to allocate and traverse efx->xdp_tx_queues lookup array. However,
> we may end up not initializing all the array slots with real queues during
> probing. This results, for example, in a NULL pointer dereference, when running
> "# ethtool -S <iface>", similar to below
...
> diff --git a/drivers/net/ethernet/sfc/efx_channels.c b/drivers/net/ethernet/sfc/efx_channels.c
> index 1bfeee283ea9..a3ca406a3561 100644
> --- a/drivers/net/ethernet/sfc/efx_channels.c
> +++ b/drivers/net/ethernet/sfc/efx_channels.c
> @@ -914,6 +914,8 @@ int efx_set_channels(struct efx_nic *efx)
> }
> }
> }
> + if (xdp_queue_number)
Wait, why is this guard condition needed?
What happens if we had nonzero efx->xdp_tx_queue_count initially, but we end up
with no TXQs available for XDP at all (so xdp_queue_number == 0)?
-ed
> + efx->xdp_tx_queue_count = xdp_queue_number;
>
> rc = netif_set_real_num_tx_queues(efx->net_dev, efx->n_tx_channels);
> if (rc)
>
Powered by blists - more mailing lists