Skip to content

Commit f3b5ad8

Browse files
committed
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma
Pull rdma fixes from Jason Gunthorpe: "More fixes from testing done on the rc kernel, including more SELinux testing. Looking forward, lockdep found regression today in ipoib which is still being fixed. Summary: - Fix for SELinux on the umad SMI path. Some old hardware does not fill the PKey properly exposing another bug in the newer SELinux code. - Check the input port as we can exceed array bounds from this user supplied value - Users are unable to use the hash field support as they want due to incorrect checks on the field restrictions, correct that so the feature works as intended - User triggerable oops in the NETLINK_RDMA handler - cxgb4 driver fix for a bad interaction with CQ flushing in iser caused by patches in this merge window, and bad CQ flushing during normal close. - Unbalanced memalloc_noio in ipoib in an error path" * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma: IB/ipoib: Restore MM behavior in case of tx_ring allocation failure iw_cxgb4: only insert drain cqes if wq is flushed iw_cxgb4: only clear the ARMED bit if a notification is needed RDMA/netlink: Fix general protection fault IB/mlx4: Fix RSS hash fields restrictions IB/core: Don't enforce PKey security on SMI MADs IB/core: Bound check alternate path port number
2 parents f25e229 + 9d98e19 commit f3b5ad8

File tree

10 files changed

+56
-19
lines changed

10 files changed

+56
-19
lines changed

drivers/infiniband/core/cma.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4458,7 +4458,7 @@ static int cma_get_id_stats(struct sk_buff *skb, struct netlink_callback *cb)
44584458
return skb->len;
44594459
}
44604460

4461-
static const struct rdma_nl_cbs cma_cb_table[] = {
4461+
static const struct rdma_nl_cbs cma_cb_table[RDMA_NL_RDMA_CM_NUM_OPS] = {
44624462
[RDMA_NL_RDMA_CM_ID_STATS] = { .dump = cma_get_id_stats},
44634463
};
44644464

drivers/infiniband/core/device.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1146,7 +1146,7 @@ struct net_device *ib_get_net_dev_by_params(struct ib_device *dev,
11461146
}
11471147
EXPORT_SYMBOL(ib_get_net_dev_by_params);
11481148

1149-
static const struct rdma_nl_cbs ibnl_ls_cb_table[] = {
1149+
static const struct rdma_nl_cbs ibnl_ls_cb_table[RDMA_NL_LS_NUM_OPS] = {
11501150
[RDMA_NL_LS_OP_RESOLVE] = {
11511151
.doit = ib_nl_handle_resolve_resp,
11521152
.flags = RDMA_NL_ADMIN_PERM,

drivers/infiniband/core/iwcm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ const char *__attribute_const__ iwcm_reject_msg(int reason)
8080
}
8181
EXPORT_SYMBOL(iwcm_reject_msg);
8282

83-
static struct rdma_nl_cbs iwcm_nl_cb_table[] = {
83+
static struct rdma_nl_cbs iwcm_nl_cb_table[RDMA_NL_IWPM_NUM_OPS] = {
8484
[RDMA_NL_IWPM_REG_PID] = {.dump = iwpm_register_pid_cb},
8585
[RDMA_NL_IWPM_ADD_MAPPING] = {.dump = iwpm_add_mapping_cb},
8686
[RDMA_NL_IWPM_QUERY_MAPPING] = {.dump = iwpm_add_and_query_mapping_cb},

drivers/infiniband/core/nldev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ out: cb->args[0] = idx;
303303
return skb->len;
304304
}
305305

306-
static const struct rdma_nl_cbs nldev_cb_table[] = {
306+
static const struct rdma_nl_cbs nldev_cb_table[RDMA_NLDEV_NUM_OPS] = {
307307
[RDMA_NLDEV_CMD_GET] = {
308308
.doit = nldev_get_doit,
309309
.dump = nldev_get_dumpit,

drivers/infiniband/core/security.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -739,8 +739,11 @@ int ib_mad_enforce_security(struct ib_mad_agent_private *map, u16 pkey_index)
739739
if (!rdma_protocol_ib(map->agent.device, map->agent.port_num))
740740
return 0;
741741

742-
if (map->agent.qp->qp_type == IB_QPT_SMI && !map->agent.smp_allowed)
743-
return -EACCES;
742+
if (map->agent.qp->qp_type == IB_QPT_SMI) {
743+
if (!map->agent.smp_allowed)
744+
return -EACCES;
745+
return 0;
746+
}
744747

745748
return ib_security_pkey_access(map->agent.device,
746749
map->agent.port_num,

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;

drivers/infiniband/hw/cxgb4/cq.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,11 @@ void c4iw_flush_hw_cq(struct c4iw_cq *chp)
395395

396396
static int cqe_completes_wr(struct t4_cqe *cqe, struct t4_wq *wq)
397397
{
398+
if (CQE_OPCODE(cqe) == C4IW_DRAIN_OPCODE) {
399+
WARN_ONCE(1, "Unexpected DRAIN CQE qp id %u!\n", wq->sq.qid);
400+
return 0;
401+
}
402+
398403
if (CQE_OPCODE(cqe) == FW_RI_TERMINATE)
399404
return 0;
400405

drivers/infiniband/hw/cxgb4/qp.c

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,12 @@ int c4iw_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
868868

869869
qhp = to_c4iw_qp(ibqp);
870870
spin_lock_irqsave(&qhp->lock, flag);
871-
if (t4_wq_in_error(&qhp->wq)) {
871+
872+
/*
873+
* If the qp has been flushed, then just insert a special
874+
* drain cqe.
875+
*/
876+
if (qhp->wq.flushed) {
872877
spin_unlock_irqrestore(&qhp->lock, flag);
873878
complete_sq_drain_wr(qhp, wr);
874879
return err;
@@ -1011,7 +1016,12 @@ int c4iw_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr,
10111016

10121017
qhp = to_c4iw_qp(ibqp);
10131018
spin_lock_irqsave(&qhp->lock, flag);
1014-
if (t4_wq_in_error(&qhp->wq)) {
1019+
1020+
/*
1021+
* If the qp has been flushed, then just insert a special
1022+
* drain cqe.
1023+
*/
1024+
if (qhp->wq.flushed) {
10151025
spin_unlock_irqrestore(&qhp->lock, flag);
10161026
complete_rq_drain_wr(qhp, wr);
10171027
return err;
@@ -1285,21 +1295,21 @@ static void __flush_qp(struct c4iw_qp *qhp, struct c4iw_cq *rchp,
12851295
spin_unlock_irqrestore(&rchp->lock, flag);
12861296

12871297
if (schp == rchp) {
1288-
if (t4_clear_cq_armed(&rchp->cq) &&
1289-
(rq_flushed || sq_flushed)) {
1298+
if ((rq_flushed || sq_flushed) &&
1299+
t4_clear_cq_armed(&rchp->cq)) {
12901300
spin_lock_irqsave(&rchp->comp_handler_lock, flag);
12911301
(*rchp->ibcq.comp_handler)(&rchp->ibcq,
12921302
rchp->ibcq.cq_context);
12931303
spin_unlock_irqrestore(&rchp->comp_handler_lock, flag);
12941304
}
12951305
} else {
1296-
if (t4_clear_cq_armed(&rchp->cq) && rq_flushed) {
1306+
if (rq_flushed && t4_clear_cq_armed(&rchp->cq)) {
12971307
spin_lock_irqsave(&rchp->comp_handler_lock, flag);
12981308
(*rchp->ibcq.comp_handler)(&rchp->ibcq,
12991309
rchp->ibcq.cq_context);
13001310
spin_unlock_irqrestore(&rchp->comp_handler_lock, flag);
13011311
}
1302-
if (t4_clear_cq_armed(&schp->cq) && sq_flushed) {
1312+
if (sq_flushed && t4_clear_cq_armed(&schp->cq)) {
13031313
spin_lock_irqsave(&schp->comp_handler_lock, flag);
13041314
(*schp->ibcq.comp_handler)(&schp->ibcq,
13051315
schp->ibcq.cq_context);

drivers/infiniband/hw/mlx4/qp.c

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,19 @@ static int set_qp_rss(struct mlx4_ib_dev *dev, struct mlx4_ib_rss *rss_ctx,
666666
return (-EOPNOTSUPP);
667667
}
668668

669+
if (ucmd->rx_hash_fields_mask & ~(MLX4_IB_RX_HASH_SRC_IPV4 |
670+
MLX4_IB_RX_HASH_DST_IPV4 |
671+
MLX4_IB_RX_HASH_SRC_IPV6 |
672+
MLX4_IB_RX_HASH_DST_IPV6 |
673+
MLX4_IB_RX_HASH_SRC_PORT_TCP |
674+
MLX4_IB_RX_HASH_DST_PORT_TCP |
675+
MLX4_IB_RX_HASH_SRC_PORT_UDP |
676+
MLX4_IB_RX_HASH_DST_PORT_UDP)) {
677+
pr_debug("RX Hash fields_mask has unsupported mask (0x%llx)\n",
678+
ucmd->rx_hash_fields_mask);
679+
return (-EOPNOTSUPP);
680+
}
681+
669682
if ((ucmd->rx_hash_fields_mask & MLX4_IB_RX_HASH_SRC_IPV4) &&
670683
(ucmd->rx_hash_fields_mask & MLX4_IB_RX_HASH_DST_IPV4)) {
671684
rss_ctx->flags = MLX4_RSS_IPV4;
@@ -691,11 +704,11 @@ static int set_qp_rss(struct mlx4_ib_dev *dev, struct mlx4_ib_rss *rss_ctx,
691704
return (-EOPNOTSUPP);
692705
}
693706

694-
if (rss_ctx->flags & MLX4_RSS_IPV4) {
707+
if (rss_ctx->flags & MLX4_RSS_IPV4)
695708
rss_ctx->flags |= MLX4_RSS_UDP_IPV4;
696-
} else if (rss_ctx->flags & MLX4_RSS_IPV6) {
709+
if (rss_ctx->flags & MLX4_RSS_IPV6)
697710
rss_ctx->flags |= MLX4_RSS_UDP_IPV6;
698-
} else {
711+
if (!(rss_ctx->flags & (MLX4_RSS_IPV6 | MLX4_RSS_IPV4))) {
699712
pr_debug("RX Hash fields_mask is not supported - UDP must be set with IPv4 or IPv6\n");
700713
return (-EOPNOTSUPP);
701714
}
@@ -707,15 +720,14 @@ static int set_qp_rss(struct mlx4_ib_dev *dev, struct mlx4_ib_rss *rss_ctx,
707720

708721
if ((ucmd->rx_hash_fields_mask & MLX4_IB_RX_HASH_SRC_PORT_TCP) &&
709722
(ucmd->rx_hash_fields_mask & MLX4_IB_RX_HASH_DST_PORT_TCP)) {
710-
if (rss_ctx->flags & MLX4_RSS_IPV4) {
723+
if (rss_ctx->flags & MLX4_RSS_IPV4)
711724
rss_ctx->flags |= MLX4_RSS_TCP_IPV4;
712-
} else if (rss_ctx->flags & MLX4_RSS_IPV6) {
725+
if (rss_ctx->flags & MLX4_RSS_IPV6)
713726
rss_ctx->flags |= MLX4_RSS_TCP_IPV6;
714-
} else {
727+
if (!(rss_ctx->flags & (MLX4_RSS_IPV6 | MLX4_RSS_IPV4))) {
715728
pr_debug("RX Hash fields_mask is not supported - TCP must be set with IPv4 or IPv6\n");
716729
return (-EOPNOTSUPP);
717730
}
718-
719731
} else if ((ucmd->rx_hash_fields_mask & MLX4_IB_RX_HASH_SRC_PORT_TCP) ||
720732
(ucmd->rx_hash_fields_mask & MLX4_IB_RX_HASH_DST_PORT_TCP)) {
721733
pr_debug("RX Hash fields_mask is not supported - both TCP SRC and DST must be set\n");

drivers/infiniband/ulp/ipoib/ipoib_cm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,6 +1145,7 @@ static int ipoib_cm_tx_init(struct ipoib_cm_tx *p, u32 qpn,
11451145
noio_flag = memalloc_noio_save();
11461146
p->tx_ring = vzalloc(ipoib_sendq_size * sizeof(*p->tx_ring));
11471147
if (!p->tx_ring) {
1148+
memalloc_noio_restore(noio_flag);
11481149
ret = -ENOMEM;
11491150
goto err_tx;
11501151
}

0 commit comments

Comments
 (0)