Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sfc: Avoid NULL pointer dereference on systems without numa awareness

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@gmail.com>
Reviewed-by: Íñigo Huguet <ihuguet@redhat.com>
Link: https://lore.kernel.org/r/164857006953.8140.3265568858101821256.stgit@palantir17.mph.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Martin Habets and committed by
Jakub Kicinski
c9ad266b 8f0588e8

+4 -7
+4 -7
drivers/net/ethernet/sfc/efx_channels.c
··· 91 91 } 92 92 93 93 cpumask_copy(filter_mask, cpu_online_mask); 94 - if (local_node) { 95 - int numa_node = pcibus_to_node(efx->pci_dev->bus); 96 - 97 - cpumask_and(filter_mask, filter_mask, cpumask_of_node(numa_node)); 98 - } 94 + if (local_node) 95 + cpumask_and(filter_mask, filter_mask, 96 + cpumask_of_pcibus(efx->pci_dev->bus)); 99 97 100 98 count = 0; 101 99 for_each_cpu(cpu, filter_mask) { ··· 384 386 #if defined(CONFIG_SMP) 385 387 void efx_set_interrupt_affinity(struct efx_nic *efx) 386 388 { 387 - int numa_node = pcibus_to_node(efx->pci_dev->bus); 388 - const struct cpumask *numa_mask = cpumask_of_node(numa_node); 389 + const struct cpumask *numa_mask = cpumask_of_pcibus(efx->pci_dev->bus); 389 390 struct efx_channel *channel; 390 391 unsigned int cpu; 391 392