mlx4_en: fix allocation of CPU affinity reverse-map
authorKleber Sacilotto de Souza <klebers@linux.vnet.ibm.com>
Fri, 22 Feb 2013 19:14:52 +0000 (19:14 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Feb 2013 13:38:41 +0000 (05:38 -0800)
commita64f554348c7334e80acae165e8f0c302e50b07e
tree174fbc2e5e5dc9fd2d82a9bb7a010c2295ad0d76
parent1707248f45ca2be86156c9ee2bf3dc34a9d55c8a
mlx4_en: fix allocation of CPU affinity reverse-map

[ Upstream commit 3770699675dd1b8fc1e86ff369eb3cce44e10082 ]

The mlx4_en driver allocates the number of objects for the CPU affinity
reverse-map based on the number of rx rings of the device. However,
mlx4_assign_eq() calls irq_cpu_rmap_add() as many times as IRQ's are
assigned to EQ's, which can be as large as mlx4_dev->caps.comp_pool. If
caps.comp_pool is larger than rx_ring_num we will eventually hit the
BUG_ON() in cpu_rmap_add().

Fix this problem by allocating space for the maximum number of CPU
affinity reverse-map objects we might want to add.

Signed-off-by: Kleber Sacilotto de Souza <klebers@linux.vnet.ibm.com>
Acked-by: Amir Vadai <amirv@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/mellanox/mlx4/en_netdev.c