Skip to content

Commit 4cae8ff

Browse files
Daniel Jurgensdledford
authored andcommitted
IB/core: Bound check alternate path port number
The alternate port number is used as an array index in the IB security implementation, invalid values can result in a kernel panic. Cc: <[email protected]> # v4.12 Fixes: d291f1a ("IB/core: Enforce PKey security on QPs") Signed-off-by: Daniel Jurgens <[email protected]> Reviewed-by: Parav Pandit <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
1 parent 315d160 commit 4cae8ff

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/infiniband/core/uverbs_cmd.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1971,6 +1971,12 @@ static int modify_qp(struct ib_uverbs_file *file,
19711971
goto release_qp;
19721972
}
19731973

1974+
if ((cmd->base.attr_mask & IB_QP_ALT_PATH) &&
1975+
!rdma_is_port_valid(qp->device, cmd->base.alt_port_num)) {
1976+
ret = -EINVAL;
1977+
goto release_qp;
1978+
}
1979+
19741980
attr->qp_state = cmd->base.qp_state;
19751981
attr->cur_qp_state = cmd->base.cur_qp_state;
19761982
attr->path_mtu = cmd->base.path_mtu;

0 commit comments

Comments
 (0)