Commit c9ad266b authored by Martin Habets's avatar Martin Habets Committed by Jakub Kicinski

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: c265b569 ("sfc: default config to 1 channel/core in local NUMA node only")
Fixes: 09a99ab1 ("sfc: set affinity hints in local NUMA node only")
Signed-off-by: default avatarMartin Habets <habetsm.xilinx@gmail.com>
Reviewed-by: default avatarÍñigo Huguet <ihuguet@redhat.com>
Link: https://lore.kernel.org/r/164857006953.8140.3265568858101821256.stgit@palantir17.mph.netSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 8f0588e8
...@@ -91,11 +91,9 @@ static unsigned int count_online_cores(struct efx_nic *efx, bool local_node) ...@@ -91,11 +91,9 @@ static unsigned int count_online_cores(struct efx_nic *efx, bool local_node)
} }
cpumask_copy(filter_mask, cpu_online_mask); cpumask_copy(filter_mask, cpu_online_mask);
if (local_node) { if (local_node)
int numa_node = pcibus_to_node(efx->pci_dev->bus); cpumask_and(filter_mask, filter_mask,
cpumask_of_pcibus(efx->pci_dev->bus));
cpumask_and(filter_mask, filter_mask, cpumask_of_node(numa_node));
}
count = 0; count = 0;
for_each_cpu(cpu, filter_mask) { for_each_cpu(cpu, filter_mask) {
...@@ -386,8 +384,7 @@ int efx_probe_interrupts(struct efx_nic *efx) ...@@ -386,8 +384,7 @@ int efx_probe_interrupts(struct efx_nic *efx)
#if defined(CONFIG_SMP) #if defined(CONFIG_SMP)
void efx_set_interrupt_affinity(struct efx_nic *efx) 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_pcibus(efx->pci_dev->bus);
const struct cpumask *numa_mask = cpumask_of_node(numa_node);
struct efx_channel *channel; struct efx_channel *channel;
unsigned int cpu; unsigned int cpu;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment