All of lore.kernel.org
 help / color / mirror / Atom feed
From: Edward Cree <ecree.xilinx@gmail.com>
To: Ignat Korchagin <ignat@cloudflare.com>,
	habetsm.xilinx@gmail.com, davem@davemloft.net, kuba@kernel.org,
	netdev@vger.kernel.org
Cc: kernel-team@cloudflare.com, stable@vger.kernel.org
Subject: Re: [PATCH] sfc: adjust efx->xdp_tx_queue_count with the real number of initialized queues
Date: Thu, 29 Apr 2021 15:22:06 +0100	[thread overview]
Message-ID: <a56546ee-87a1-f13d-8b2f-25497828f299@gmail.com> (raw)
In-Reply-To: <20210427210938.661700-1-ignat@cloudflare.com>

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)
> 


  parent reply	other threads:[~2021-04-29 14:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-27 21:09 [PATCH] sfc: adjust efx->xdp_tx_queue_count with the real number of initialized queues Ignat Korchagin
2021-04-27 22:40 ` patchwork-bot+netdevbpf
2021-04-29 14:22 ` Edward Cree [this message]
2021-04-29 14:49   ` Ignat Korchagin
2021-04-29 15:04     ` Edward Cree

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=a56546ee-87a1-f13d-8b2f-25497828f299@gmail.com \
    --to=ecree.xilinx@gmail.com \
    --cc=davem@davemloft.net \
    --cc=habetsm.xilinx@gmail.com \
    --cc=ignat@cloudflare.com \
    --cc=kernel-team@cloudflare.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.