Skip to content

Commit 1a0e93d

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: "Three minor bug fixes: - qedr not setting the QP timeout properly toward userspace - Memory leak on error path in ib_cm - Divide by 0 in RDMA interrupt moderation" * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma: linux/dim: Fix divide by 0 in RDMA DIM RDMA/cm: Fix memory leak in ib_cm_insert_listen RDMA/qedr: Fix reporting QP timeout attribute
2 parents 9fb3bb2 + 0fe3dbb commit 1a0e93d

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

drivers/infiniband/core/cm.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1252,8 +1252,10 @@ struct ib_cm_id *ib_cm_insert_listen(struct ib_device *device,
12521252
return ERR_CAST(cm_id_priv);
12531253

12541254
err = cm_init_listen(cm_id_priv, service_id, 0);
1255-
if (err)
1255+
if (err) {
1256+
ib_destroy_cm_id(&cm_id_priv->id);
12561257
return ERR_PTR(err);
1258+
}
12571259

12581260
spin_lock_irq(&cm_id_priv->lock);
12591261
listen_id_priv = cm_insert_listen(cm_id_priv, cm_handler);

drivers/infiniband/hw/qedr/qedr.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ struct qedr_qp {
418418
u32 sq_psn;
419419
u32 qkey;
420420
u32 dest_qp_num;
421+
u8 timeout;
421422

422423
/* Relevant to qps created from kernel space only (ULPs) */
423424
u8 prev_wqe_size;

drivers/infiniband/hw/qedr/verbs.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2613,6 +2613,8 @@ int qedr_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
26132613
1 << max_t(int, attr->timeout - 8, 0);
26142614
else
26152615
qp_params.ack_timeout = 0;
2616+
2617+
qp->timeout = attr->timeout;
26162618
}
26172619

26182620
if (attr_mask & IB_QP_RETRY_CNT) {
@@ -2772,7 +2774,7 @@ int qedr_query_qp(struct ib_qp *ibqp,
27722774
rdma_ah_set_dgid_raw(&qp_attr->ah_attr, &params.dgid.bytes[0]);
27732775
rdma_ah_set_port_num(&qp_attr->ah_attr, 1);
27742776
rdma_ah_set_sl(&qp_attr->ah_attr, 0);
2775-
qp_attr->timeout = params.timeout;
2777+
qp_attr->timeout = qp->timeout;
27762778
qp_attr->rnr_retry = params.rnr_retry;
27772779
qp_attr->retry_cnt = params.retry_cnt;
27782780
qp_attr->min_rnr_timer = params.min_rnr_nak_timer;

include/linux/dim.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* We consider 10% difference as significant.
2222
*/
2323
#define IS_SIGNIFICANT_DIFF(val, ref) \
24-
(((100UL * abs((val) - (ref))) / (ref)) > 10)
24+
((ref) && (((100UL * abs((val) - (ref))) / (ref)) > 10))
2525

2626
/*
2727
* Calculate the gap between two values.

0 commit comments

Comments
 (0)