IB/mlx4: Check that reserved fields in mlx4_ib_create_qp_rss are zero
authorGuy Levi <guyle@mellanox.com>
Thu, 17 Aug 2017 12:50:49 +0000 (15:50 +0300)
committerDoug Ledford <dledford@redhat.com>
Thu, 24 Aug 2017 20:27:11 +0000 (16:27 -0400)
According to mlx4 convention, need to fail the command due to a non-zero
value in the user data which is expected to be zero.

Fixes: 3078f5f1bd8b ("IB/mlx4: Add support for RSS QP")
Signed-off-by: Guy Levi <guyle@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/mlx4/qp.c

index c3958fcfed75fcb09f59f0c167f030683b8913c3..1ac148ddb250865f74ab37b98169b45908a52f8f 100644 (file)
@@ -812,6 +812,9 @@ static struct ib_qp *_mlx4_ib_create_qp_rss(struct ib_pd *pd,
                return ERR_PTR(-EFAULT);
        }
 
+       if (memchr_inv(ucmd.reserved, 0, sizeof(ucmd.reserved)))
+               return ERR_PTR(-EOPNOTSUPP);
+
        if (ucmd.comp_mask || ucmd.reserved1)
                return ERR_PTR(-EOPNOTSUPP);