From: Leon Romanovsky Date: Wed, 25 Mar 2026 18:16:03 +0000 (+0200) Subject: RDMA/mlx4: Restrict external umem for CQ when copy_to_user() is used X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=911e5ca3e16975866739f49b6e24c858110110bc;p=thirdparty%2Flinux.git RDMA/mlx4: Restrict external umem for CQ when copy_to_user() is used When the mlx4 firmware reports the MLX4_DEV_CAP_FLAG2_SW_CQ_INIT capability, libmlx4 from the rdma-core package expects the driver to initialize memory at the address provided in the buf_addr parameter of ucmd. This behavior cannot be supported by any external umem implementation, so restrict it accordingly. Fixes: f45f195af521 ("RDMA/mlx4: Introduce a modern CQ creation interface") Reported-by: Jiri Pirko Link: https://patch.msgid.link/20260325-fix-mlx4-external-umem-v1-1-1c7c0e779329@nvidia.com Signed-off-by: Leon Romanovsky --- diff --git a/drivers/infiniband/hw/mlx4/cq.c b/drivers/infiniband/hw/mlx4/cq.c index b391883aa400..6fef3f1724eb 100644 --- a/drivers/infiniband/hw/mlx4/cq.c +++ b/drivers/infiniband/hw/mlx4/cq.c @@ -173,6 +173,10 @@ int mlx4_ib_create_user_cq(struct ib_cq *ibcq, goto err_cq; } + if (ibcq->umem && + (dev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_SW_CQ_INIT)) + return -EOPNOTSUPP; + buf_addr = (void *)(unsigned long)ucmd.buf_addr; if (!ibcq->umem)