Commit ce9ce741 authored by Tatyana Nikolova's avatar Tatyana Nikolova Committed by Jason Gunthorpe

i40iw: Validate correct IRD/ORD connection parameters

Casting to u16 before validating IRD/ORD connection
parameters could cause recording wrong IRD/ORD values
in the cm_node. Validate the IRD/ORD parameters as
they are passed by the application before recording
them.

Fixes: f27b4746 ("i40iw: add connection management code")
Signed-off-by: default avatarTatyana Nikolova <tatyana.e.nikolova@intel.com>
Signed-off-by: default avatarShiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 756f77d2
...@@ -120,7 +120,8 @@ static u8 i40iw_derive_hw_ird_setting(u16 cm_ird) ...@@ -120,7 +120,8 @@ static u8 i40iw_derive_hw_ird_setting(u16 cm_ird)
* @conn_ird: connection IRD * @conn_ird: connection IRD
* @conn_ord: connection ORD * @conn_ord: connection ORD
*/ */
static void i40iw_record_ird_ord(struct i40iw_cm_node *cm_node, u16 conn_ird, u16 conn_ord) static void i40iw_record_ird_ord(struct i40iw_cm_node *cm_node, u32 conn_ird,
u32 conn_ord)
{ {
if (conn_ird > I40IW_MAX_IRD_SIZE) if (conn_ird > I40IW_MAX_IRD_SIZE)
conn_ird = I40IW_MAX_IRD_SIZE; conn_ird = I40IW_MAX_IRD_SIZE;
...@@ -3842,7 +3843,7 @@ int i40iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) ...@@ -3842,7 +3843,7 @@ int i40iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
} }
cm_node->apbvt_set = true; cm_node->apbvt_set = true;
i40iw_record_ird_ord(cm_node, (u16)conn_param->ird, (u16)conn_param->ord); i40iw_record_ird_ord(cm_node, conn_param->ird, conn_param->ord);
if (cm_node->send_rdma0_op == SEND_RDMA_READ_ZERO && if (cm_node->send_rdma0_op == SEND_RDMA_READ_ZERO &&
!cm_node->ord_size) !cm_node->ord_size)
cm_node->ord_size = 1; cm_node->ord_size = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment