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

net/mlx4_core: Remove unnecessary validation for port number

This is a fix to a regression introduced by commit:
"982290a net/mlx4_core: Check port number for validity
before accessing data"

IPoIB could not attach to multicast group and we get this in dmesg:
[144214.145008] ib0: failed to attach to multicast group, ret = -22
[144214.145016] ib0: couldn't attach QP to multicast group ff12:401b:ffff:0000:0000:0000:ffff:ffff
[144214.145019] ib0: multicast join failed for ff12:401b:ffff:0000:0000:0000:ffff:ffff, status -22

The cause to the problem is because port is extracted from gid[5].
Which is only valid for Ethernet.
Removed this validation in mlx4_qp_attach_common(), which is accessed
from both Ethernet and IB flows.
Error flow for bad port value in Ethernet is already exists in that
function.

Signed-off-by: Moni Shoua <monis@mellanox.co.il>
Signed-off-by: Matan Barak <matanb@mellanox.com>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Moni Shoua and committed by
David S. Miller
6cd28f04 a6b74e01

-3
-3
drivers/net/ethernet/mellanox/mlx4/mcg.c
··· 943 943 u8 port = gid[5]; 944 944 u8 new_entry = 0; 945 945 946 - if (port < 1 || port > dev->caps.num_ports) 947 - return -EINVAL; 948 - 949 946 mailbox = mlx4_alloc_cmd_mailbox(dev); 950 947 if (IS_ERR(mailbox)) 951 948 return PTR_ERR(mailbox);