Skip to content

Commit 940efcc

Browse files
Leon Romanovskyjgunthorpe
Leon Romanovsky
authored andcommitted
RDMA/uverbs: Protect from attempts to create flows on unsupported QP
Flows can be created on UD and RAW_PACKET QP types. Attempts to provide other QP types as an input causes to various unpredictable failures. The reason is that in order to support all various types (e.g. XRC), we are supposed to use real_qp handle and not qp handle and expect to driver/FW to fail such (XRC) flows. The simpler and safer variant is to ban all QP types except UD and RAW_PACKET, instead of relying on driver/FW. Cc: <[email protected]> # 3.11 Fixes: 436f2ad ("IB/core: Export ib_create/destroy_flow through uverbs") Cc: syzkaller <[email protected]> Reported-by: Noa Osherovich <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 7b72717 commit 940efcc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/infiniband/core/uverbs_cmd.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3559,6 +3559,11 @@ int ib_uverbs_ex_create_flow(struct ib_uverbs_file *file,
35593559
goto err_uobj;
35603560
}
35613561

3562+
if (qp->qp_type != IB_QPT_UD && qp->qp_type != IB_QPT_RAW_PACKET) {
3563+
err = -EINVAL;
3564+
goto err_put;
3565+
}
3566+
35623567
flow_attr = kzalloc(struct_size(flow_attr, flows,
35633568
cmd.flow_attr.num_of_specs), GFP_KERNEL);
35643569
if (!flow_attr) {

0 commit comments

Comments
 (0)