Skip to content

Commit d64b1ee

Browse files
Dan Carpenterrleon
authored andcommitted
RDMA/mlx4: Make check for invalid flags stricter
This code is trying to ensure that only the flags specified in the list are allowed. The problem is that ucmd->rx_hash_fields_mask is a u64 and the flags are an enum which is treated as a u32 in this context. That means the test doesn't check whether the highest 32 bits are zero. Fixes: 4d02ebd ("IB/mlx4: Fix RSS hash fields restrictions") Signed-off-by: Dan Carpenter <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Leon Romanovsky <[email protected]>
1 parent 06c2afb commit d64b1ee

File tree

1 file changed

+9
-9
lines changed
  • drivers/infiniband/hw/mlx4

1 file changed

+9
-9
lines changed

drivers/infiniband/hw/mlx4/qp.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -565,15 +565,15 @@ static int set_qp_rss(struct mlx4_ib_dev *dev, struct mlx4_ib_rss *rss_ctx,
565565
return (-EOPNOTSUPP);
566566
}
567567

568-
if (ucmd->rx_hash_fields_mask & ~(MLX4_IB_RX_HASH_SRC_IPV4 |
569-
MLX4_IB_RX_HASH_DST_IPV4 |
570-
MLX4_IB_RX_HASH_SRC_IPV6 |
571-
MLX4_IB_RX_HASH_DST_IPV6 |
572-
MLX4_IB_RX_HASH_SRC_PORT_TCP |
573-
MLX4_IB_RX_HASH_DST_PORT_TCP |
574-
MLX4_IB_RX_HASH_SRC_PORT_UDP |
575-
MLX4_IB_RX_HASH_DST_PORT_UDP |
576-
MLX4_IB_RX_HASH_INNER)) {
568+
if (ucmd->rx_hash_fields_mask & ~(u64)(MLX4_IB_RX_HASH_SRC_IPV4 |
569+
MLX4_IB_RX_HASH_DST_IPV4 |
570+
MLX4_IB_RX_HASH_SRC_IPV6 |
571+
MLX4_IB_RX_HASH_DST_IPV6 |
572+
MLX4_IB_RX_HASH_SRC_PORT_TCP |
573+
MLX4_IB_RX_HASH_DST_PORT_TCP |
574+
MLX4_IB_RX_HASH_SRC_PORT_UDP |
575+
MLX4_IB_RX_HASH_DST_PORT_UDP |
576+
MLX4_IB_RX_HASH_INNER)) {
577577
pr_debug("RX Hash fields_mask has unsupported mask (0x%llx)\n",
578578
ucmd->rx_hash_fields_mask);
579579
return (-EOPNOTSUPP);

0 commit comments

Comments
 (0)