mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-26 22:05:24 +07:00
net/mlx4: Verify port number in __mlx4_unregister_mac
Verify port number to avoid crashes if port number is outside the range. Signed-off-by: Eli Cohen <eli@mellanox.com> Signed-off-by: Eugenia Emantayev <eugenia@mellanox.com> Signed-off-by: Amir Vadai <amirv@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
4359db1e0d
commit
143b3efb40
@ -244,10 +244,16 @@ EXPORT_SYMBOL_GPL(mlx4_get_base_qpn);
|
||||
|
||||
void __mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, u64 mac)
|
||||
{
|
||||
struct mlx4_port_info *info = &mlx4_priv(dev)->port[port];
|
||||
struct mlx4_mac_table *table = &info->mac_table;
|
||||
struct mlx4_port_info *info;
|
||||
struct mlx4_mac_table *table;
|
||||
int index;
|
||||
|
||||
if (port < 1 || port > dev->caps.num_ports) {
|
||||
mlx4_warn(dev, "invalid port number (%d), aborting...\n", port);
|
||||
return;
|
||||
}
|
||||
info = &mlx4_priv(dev)->port[port];
|
||||
table = &info->mac_table;
|
||||
mutex_lock(&table->mutex);
|
||||
index = find_index(dev, table, mac);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user