Skip to contentSkip to conversation

request for 4.14-stable: 940efcc8889f ("RDMA/uverbs: Protect from attempts to create flows on unsupported QP")

PATCH Sudip Mukherjee 2 participants 2 messages Jul 29, 2018 – Jul 30, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi Greg,

This was missing in 4.14-stable. Please apply to your queue.

--
Regards
Sudip

Quoted 1 line

From 4c9252a8f092e69c9671109ede7090591dee2e8f Mon Sep 17 00:00:00 2001

From: Leon Romanovsky <[email protected]>
Date: Sun, 24 Jun 2018 11:23:42 +0300
Subject: [PATCH] RDMA/uverbs: Protect from attempts to create flows on unsupported QP

commit 940efcc8889f0d15567eb07fc9fd69b06e366aa5 upstream

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 436f2ad05a0b ("IB/core: Export ib_create/destroy_flow through uverbs")
Cc syzkaller <[email protected]>
---
 drivers/infiniband/core/uverbs_cmd.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/infiniband/core/uverbs_cmd.c +5 -0
index 186dce6bba8f..b8229d7b0ff5 100644
@@ -3376,6 +3376,11 @@ int ib_uverbs_ex_create_flow(struct ib_uverbs_file *file,
 		goto err_uobj;
 	}
 
+	if (qp->qp_type != IB_QPT_UD && qp->qp_type != IB_QPT_RAW_PACKET) {
+		err = -EINVAL;
+		goto err_put;
+	}
+
 	flow_attr = kzalloc(sizeof(*flow_attr) + cmd.flow_attr.num_of_specs *
 			    sizeof(union ib_flow_spec), GFP_KERNEL);
 	if (!flow_attr) {
Signature · 1 line
2.11.0
#1 lore raw
Quoted 3 lines · Sudip Mukherjee

Hi Greg,

This was missing in 4.14-stable. Please apply to your queue.

Also missing in 4.9 and 4.17, so I've added it everywhere, thanks!

greg k-h