Skip to content

Commit ec78b3b

Browse files
mark-blochjgunthorpe
authored andcommitted
RDMA/mlx4: Read pkey table length instead of hardcoded value
If the pkey_table is not available (which is the case when RoCE is not supported), the cited commit caused a regression where mlx4_devices without RoCE are not created. Fix this by returning a pkey table length of zero in procedure eth_link_query_port() if the pkey-table length reported by the device is zero. Link: https://lore.kernel.org/r/[email protected] Cc: <[email protected]> Fixes: 1901b91 ("IB/core: Fix potential NULL pointer dereference in pkey cache") Fixes: fa417f7 ("IB/mlx4: Add support for IBoE") Signed-off-by: Mark Bloch <[email protected]> Reviewed-by: Maor Gottlieb <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent d862060 commit ec78b3b

File tree

1 file changed

+2
-1
lines changed
  • drivers/infiniband/hw/mlx4

1 file changed

+2
-1
lines changed

drivers/infiniband/hw/mlx4/main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,8 @@ static int eth_link_query_port(struct ib_device *ibdev, u8 port,
784784
props->ip_gids = true;
785785
props->gid_tbl_len = mdev->dev->caps.gid_table_len[port];
786786
props->max_msg_sz = mdev->dev->caps.max_msg_sz;
787-
props->pkey_tbl_len = 1;
787+
if (mdev->dev->caps.pkey_table_len[port])
788+
props->pkey_tbl_len = 1;
788789
props->max_mtu = IB_MTU_4096;
789790
props->max_vl_num = 2;
790791
props->state = IB_PORT_DOWN;

0 commit comments

Comments
 (0)