Skip to content

Commit ab2aa48

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: "Nothing very exciting here, it has been a quiet cycle overall. Usual collection of small bug fixes: - irdma issues with CQ entries, VLAN completions and a mutex deadlock - Incorrect DCT packets in mlx5 - Userspace triggered overflows in qib - Locking error in hfi - Typo in errno value in qib/hfi1 - Double free in qedr - Leak of random kernel memory to userspace with a netlink callback" * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma: RDMA/sa_query: Use strscpy_pad instead of memcpy to copy a string RDMA/irdma: Do not hold qos mutex twice on QP resume RDMA/irdma: Set VLAN in UD work completion correctly RDMA/mlx5: Initialize the ODP xarray when creating an ODP MR rdma/qedr: Fix crash due to redundant release of device's qp memory RDMA/rdmavt: Fix error code in rvt_create_qp() IB/hfi1: Fix abba locking issue with sc_disable() IB/qib: Protect from buffer overflow in struct qib_user_sdma_pkt fields RDMA/mlx5: Set user priority for DCT RDMA/irdma: Process extended CQ entries correctly
2 parents d25f274 + 6473395 commit ab2aa48

File tree

12 files changed

+57
-29
lines changed

12 files changed

+57
-29
lines changed

drivers/infiniband/core/sa_query.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -706,8 +706,9 @@ static void ib_nl_set_path_rec_attrs(struct sk_buff *skb,
706706

707707
/* Construct the family header first */
708708
header = skb_put(skb, NLMSG_ALIGN(sizeof(*header)));
709-
memcpy(header->device_name, dev_name(&query->port->agent->device->dev),
710-
LS_DEVICE_NAME_MAX);
709+
strscpy_pad(header->device_name,
710+
dev_name(&query->port->agent->device->dev),
711+
LS_DEVICE_NAME_MAX);
711712
header->port_num = query->port->port_num;
712713

713714
if ((comp_mask & IB_SA_PATH_REC_REVERSIBLE) &&

drivers/infiniband/hw/hfi1/pio.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,7 @@ void sc_disable(struct send_context *sc)
878878
{
879879
u64 reg;
880880
struct pio_buf *pbuf;
881+
LIST_HEAD(wake_list);
881882

882883
if (!sc)
883884
return;
@@ -912,19 +913,21 @@ void sc_disable(struct send_context *sc)
912913
spin_unlock(&sc->release_lock);
913914

914915
write_seqlock(&sc->waitlock);
915-
while (!list_empty(&sc->piowait)) {
916+
if (!list_empty(&sc->piowait))
917+
list_move(&sc->piowait, &wake_list);
918+
write_sequnlock(&sc->waitlock);
919+
while (!list_empty(&wake_list)) {
916920
struct iowait *wait;
917921
struct rvt_qp *qp;
918922
struct hfi1_qp_priv *priv;
919923

920-
wait = list_first_entry(&sc->piowait, struct iowait, list);
924+
wait = list_first_entry(&wake_list, struct iowait, list);
921925
qp = iowait_to_qp(wait);
922926
priv = qp->priv;
923927
list_del_init(&priv->s_iowait.list);
924928
priv->s_iowait.lock = NULL;
925929
hfi1_qp_wakeup(qp, RVT_S_WAIT_PIO | HFI1_S_WAIT_PIO_DRAIN);
926930
}
927-
write_sequnlock(&sc->waitlock);
928931

929932
spin_unlock_irq(&sc->alloc_lock);
930933
}

drivers/infiniband/hw/irdma/uk.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,12 +1092,12 @@ irdma_uk_cq_poll_cmpl(struct irdma_cq_uk *cq, struct irdma_cq_poll_info *info)
10921092
if (cq->avoid_mem_cflct) {
10931093
ext_cqe = (__le64 *)((u8 *)cqe + 32);
10941094
get_64bit_val(ext_cqe, 24, &qword7);
1095-
polarity = (u8)FIELD_GET(IRDMA_CQ_VALID, qword3);
1095+
polarity = (u8)FIELD_GET(IRDMA_CQ_VALID, qword7);
10961096
} else {
10971097
peek_head = (cq->cq_ring.head + 1) % cq->cq_ring.size;
10981098
ext_cqe = cq->cq_base[peek_head].buf;
10991099
get_64bit_val(ext_cqe, 24, &qword7);
1100-
polarity = (u8)FIELD_GET(IRDMA_CQ_VALID, qword3);
1100+
polarity = (u8)FIELD_GET(IRDMA_CQ_VALID, qword7);
11011101
if (!peek_head)
11021102
polarity ^= 1;
11031103
}

drivers/infiniband/hw/irdma/verbs.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3399,9 +3399,13 @@ static void irdma_process_cqe(struct ib_wc *entry,
33993399
}
34003400

34013401
if (cq_poll_info->ud_vlan_valid) {
3402-
entry->vlan_id = cq_poll_info->ud_vlan & VLAN_VID_MASK;
3403-
entry->wc_flags |= IB_WC_WITH_VLAN;
3402+
u16 vlan = cq_poll_info->ud_vlan & VLAN_VID_MASK;
3403+
34043404
entry->sl = cq_poll_info->ud_vlan >> VLAN_PRIO_SHIFT;
3405+
if (vlan) {
3406+
entry->vlan_id = vlan;
3407+
entry->wc_flags |= IB_WC_WITH_VLAN;
3408+
}
34053409
} else {
34063410
entry->sl = 0;
34073411
}

drivers/infiniband/hw/irdma/ws.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,10 @@ enum irdma_status_code irdma_ws_add(struct irdma_sc_vsi *vsi, u8 user_pri)
330330

331331
tc_node->enable = true;
332332
ret = irdma_ws_cqp_cmd(vsi, tc_node, IRDMA_OP_WS_MODIFY_NODE);
333-
if (ret)
333+
if (ret) {
334+
vsi->unregister_qset(vsi, tc_node);
334335
goto reg_err;
336+
}
335337
}
336338
ibdev_dbg(to_ibdev(vsi->dev),
337339
"WS: Using node %d which represents VSI %d TC %d\n",
@@ -350,6 +352,10 @@ enum irdma_status_code irdma_ws_add(struct irdma_sc_vsi *vsi, u8 user_pri)
350352
}
351353
goto exit;
352354

355+
reg_err:
356+
irdma_ws_cqp_cmd(vsi, tc_node, IRDMA_OP_WS_DELETE_NODE);
357+
list_del(&tc_node->siblings);
358+
irdma_free_node(vsi, tc_node);
353359
leaf_add_err:
354360
if (list_empty(&vsi_node->child_list_head)) {
355361
if (irdma_ws_cqp_cmd(vsi, vsi_node, IRDMA_OP_WS_DELETE_NODE))
@@ -369,11 +375,6 @@ enum irdma_status_code irdma_ws_add(struct irdma_sc_vsi *vsi, u8 user_pri)
369375
exit:
370376
mutex_unlock(&vsi->dev->ws_mutex);
371377
return ret;
372-
373-
reg_err:
374-
mutex_unlock(&vsi->dev->ws_mutex);
375-
irdma_ws_remove(vsi, user_pri);
376-
return ret;
377378
}
378379

379380
/**

drivers/infiniband/hw/mlx5/mr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1339,7 +1339,6 @@ static struct mlx5_ib_mr *reg_create(struct ib_pd *pd, struct ib_umem *umem,
13391339
goto err_2;
13401340
}
13411341
mr->mmkey.type = MLX5_MKEY_MR;
1342-
mr->desc_size = sizeof(struct mlx5_mtt);
13431342
mr->umem = umem;
13441343
set_mr_fields(dev, mr, umem->length, access_flags);
13451344
kvfree(in);
@@ -1533,6 +1532,7 @@ static struct ib_mr *create_user_odp_mr(struct ib_pd *pd, u64 start, u64 length,
15331532
ib_umem_release(&odp->umem);
15341533
return ERR_CAST(mr);
15351534
}
1535+
xa_init(&mr->implicit_children);
15361536

15371537
odp->private = mr;
15381538
err = mlx5r_store_odp_mkey(dev, &mr->mmkey);

drivers/infiniband/hw/mlx5/qp.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4458,6 +4458,8 @@ static int mlx5_ib_modify_dct(struct ib_qp *ibqp, struct ib_qp_attr *attr,
44584458
MLX5_SET(dctc, dctc, mtu, attr->path_mtu);
44594459
MLX5_SET(dctc, dctc, my_addr_index, attr->ah_attr.grh.sgid_index);
44604460
MLX5_SET(dctc, dctc, hop_limit, attr->ah_attr.grh.hop_limit);
4461+
if (attr->ah_attr.type == RDMA_AH_ATTR_TYPE_ROCE)
4462+
MLX5_SET(dctc, dctc, eth_prio, attr->ah_attr.sl & 0x7);
44614463

44624464
err = mlx5_core_create_dct(dev, &qp->dct.mdct, qp->dct.in,
44634465
MLX5_ST_SZ_BYTES(create_dct_in), out,

drivers/infiniband/hw/qedr/qedr.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,7 @@ struct qedr_qp {
455455
/* synchronization objects used with iwarp ep */
456456
struct kref refcnt;
457457
struct completion iwarp_cm_comp;
458+
struct completion qp_rel_comp;
458459
unsigned long iwarp_cm_flags; /* enum iwarp_cm_flags */
459460
};
460461

drivers/infiniband/hw/qedr/qedr_iw_cm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ static void qedr_iw_free_qp(struct kref *ref)
8383
{
8484
struct qedr_qp *qp = container_of(ref, struct qedr_qp, refcnt);
8585

86-
kfree(qp);
86+
complete(&qp->qp_rel_comp);
8787
}
8888

8989
static void

drivers/infiniband/hw/qedr/verbs.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1357,6 +1357,7 @@ static void qedr_set_common_qp_params(struct qedr_dev *dev,
13571357
if (rdma_protocol_iwarp(&dev->ibdev, 1)) {
13581358
kref_init(&qp->refcnt);
13591359
init_completion(&qp->iwarp_cm_comp);
1360+
init_completion(&qp->qp_rel_comp);
13601361
}
13611362

13621363
qp->pd = pd;
@@ -2857,8 +2858,10 @@ int qedr_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata)
28572858

28582859
qedr_free_qp_resources(dev, qp, udata);
28592860

2860-
if (rdma_protocol_iwarp(&dev->ibdev, 1))
2861+
if (rdma_protocol_iwarp(&dev->ibdev, 1)) {
28612862
qedr_iw_qp_rem_ref(&qp->ibqp);
2863+
wait_for_completion(&qp->qp_rel_comp);
2864+
}
28622865

28632866
return 0;
28642867
}

0 commit comments

Comments
 (0)