[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACT4ouco5oPQ9-qAwU0MgeK_+9K_1UmO0O9o3vofDbTTULY7eA@mail.gmail.com>
Date: Wed, 30 Mar 2022 11:28:36 +0200
From: Íñigo Huguet <ihuguet@...hat.com>
To: Martin Habets <habetsm.xilinx@...il.com>
Cc: Jakub Kicinski <kuba@...nel.org>, pabeni@...hat.com,
"David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
Edward Cree <ecree.xilinx@...il.com>
Subject: Re: [PATCH net] sfc: Avoid NULL pointer dereference on systems
without numa awareness
On Tue, Mar 29, 2022 at 6:08 PM Martin Habets <habetsm.xilinx@...il.com> wrote:
>
> On such systems cpumask_of_node() returns NULL, which bitmap
> operations are not happy with.
>
> Fixes: c265b569a45f ("sfc: default config to 1 channel/core in local NUMA node only")
> Fixes: 09a99ab16c60 ("sfc: set affinity hints in local NUMA node only")
> Signed-off-by: Martin Habets <habetsm.xilinx@...il.com>
> ---
> drivers/net/ethernet/sfc/efx_channels.c | 11 ++++-------
> 1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/ethernet/sfc/efx_channels.c b/drivers/net/ethernet/sfc/efx_channels.c
> index d6fdcdc530ca..f9064532beb6 100644
> --- a/drivers/net/ethernet/sfc/efx_channels.c
> +++ b/drivers/net/ethernet/sfc/efx_channels.c
> @@ -91,11 +91,9 @@ static unsigned int count_online_cores(struct efx_nic *efx, bool local_node)
> }
>
> cpumask_copy(filter_mask, cpu_online_mask);
> - if (local_node) {
> - int numa_node = pcibus_to_node(efx->pci_dev->bus);
> -
> - cpumask_and(filter_mask, filter_mask, cpumask_of_node(numa_node));
> - }
> + if (local_node)
> + cpumask_and(filter_mask, filter_mask,
> + cpumask_of_pcibus(efx->pci_dev->bus));
>
> count = 0;
> for_each_cpu(cpu, filter_mask) {
> @@ -386,8 +384,7 @@ int efx_probe_interrupts(struct efx_nic *efx)
> #if defined(CONFIG_SMP)
> void efx_set_interrupt_affinity(struct efx_nic *efx)
> {
> - int numa_node = pcibus_to_node(efx->pci_dev->bus);
> - const struct cpumask *numa_mask = cpumask_of_node(numa_node);
> + const struct cpumask *numa_mask = cpumask_of_pcibus(efx->pci_dev->bus);
> struct efx_channel *channel;
> unsigned int cpu;
>
>
Reviewed-by: Íñigo Huguet <ihuguet@...hat.com>
--
Íñigo Huguet
Powered by blists - more mailing lists