Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

IB/mthca: check port validity in modify_qp

Modify_qp should check that the physical port number provided
is a legal value.

Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>

authored by

Jack Morgenstein and committed by
Roland Dreier
38d1e793 aa2f9367

+6
+6
drivers/infiniband/hw/mthca/mthca_qp.c
··· 621 621 return -EINVAL; 622 622 } 623 623 624 + if ((attr_mask & IB_QP_PORT) && 625 + (attr->port_num == 0 || attr->port_num > dev->limits.num_ports)) { 626 + mthca_dbg(dev, "Port number (%u) is invalid\n", attr->port_num); 627 + return -EINVAL; 628 + } 629 + 624 630 if (attr_mask & IB_QP_MAX_QP_RD_ATOMIC && 625 631 attr->max_rd_atomic > dev->limits.max_qp_init_rdma) { 626 632 mthca_dbg(dev, "Max rdma_atomic as initiator %u too large (max is %d)\n",