stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] IB/hfi1,qib: Fixes for 4.12-rc
@ 2017-05-12 16:01 Dennis Dalessandro
  2017-05-12 16:02 ` [PATCH 2/2] IB/qib, IB/hfi1: Fix MR reference count leak on write with immediate Dennis Dalessandro
  2017-06-01 22:12 ` [PATCH 0/2] IB/hfi1,qib: Fixes for 4.12-rc Doug Ledford
  0 siblings, 2 replies; 3+ messages in thread
From: Dennis Dalessandro @ 2017-05-12 16:01 UTC (permalink / raw)
  To: dledford
  Cc: Mike Marciniszyn, Dean Luick, Jakub Byczkowski, Tadeusz Struk,
	linux-rdma, Stable

Hi Doug,

Here are two patches that I think should be RC worthy. One fixes a bug where
packets could be sent before the other side is ready. The other fixes an MR ref
count leak for write-only-with-immediate when the buffer allocation for the
immediate data fails. This one is in both qib and hfi1. Ideally we will move
this code to rdmavt to get rid of the duplication but would like to get this fix
out for RC and the stable kernels.

These apply on top of:
67cf362 : rxe: expose num_possible_cpus() cnum_comp_vectors

Patches can can also be found in my GitHub repo at:
https://github.com/ddalessa/kernel/tree/for-4.12

---

Byczkowski, Jakub (1):
      IB/hfi1: Defer setting VL15 credits to link-up interrupt

Mike Marciniszyn (1):
      IB/qib,IB/hfi1: Fix MR reference count leak on write with immediate


 drivers/infiniband/hw/hfi1/chip.c           |   67 ++++++++++++++++++++-------
 drivers/infiniband/hw/hfi1/chip_registers.h |    2 +
 drivers/infiniband/hw/hfi1/hfi.h            |   11 ++++
 drivers/infiniband/hw/hfi1/intr.c           |    3 +
 drivers/infiniband/hw/hfi1/rc.c             |    5 ++
 drivers/infiniband/hw/qib/qib_rc.c          |    4 +-
 6 files changed, 71 insertions(+), 21 deletions(-)

--
-Denny

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] IB/qib, IB/hfi1: Fix MR reference count leak on write with immediate
  2017-05-12 16:01 [PATCH 0/2] IB/hfi1,qib: Fixes for 4.12-rc Dennis Dalessandro
@ 2017-05-12 16:02 ` Dennis Dalessandro
  2017-06-01 22:12 ` [PATCH 0/2] IB/hfi1,qib: Fixes for 4.12-rc Doug Ledford
  1 sibling, 0 replies; 3+ messages in thread
From: Dennis Dalessandro @ 2017-05-12 16:02 UTC (permalink / raw)
  To: dledford; +Cc: linux-rdma, Mike Marciniszyn, Stable, Tadeusz Struk

From: Mike Marciniszyn <mike.marciniszyn@intel.com>

The handling of IB_RDMA_WRITE_ONLY_WITH_IMMEDIATE will leak a memory
reference when a buffer cannot be allocated for returning the immediate
data.

The issue is that the rkey validation has already occurred and the RNR
nak fails to release the reference that was fruitlessly gotten.  The
the peer will send the identical single packet request when its RNR
timer pops.

The fix is to release the held reference prior to the rnr nak exit.
This is the only sequence the requires both rkey validation and the
buffer allocation on the same packet.

Cc: Stable <stable@vger.kernel.org> # 4.7+
Tested-by: Tadeusz Struk <tadeusz.struk@intel.com>
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
---
 drivers/infiniband/hw/hfi1/rc.c    |    5 ++++-
 drivers/infiniband/hw/qib/qib_rc.c |    4 +++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/hfi1/rc.c b/drivers/infiniband/hw/hfi1/rc.c
index 069bdaf..1080778 100644
--- a/drivers/infiniband/hw/hfi1/rc.c
+++ b/drivers/infiniband/hw/hfi1/rc.c
@@ -2159,8 +2159,11 @@ void hfi1_rc_rcv(struct hfi1_packet *packet)
 		ret = hfi1_rvt_get_rwqe(qp, 1);
 		if (ret < 0)
 			goto nack_op_err;
-		if (!ret)
+		if (!ret) {
+			/* peer will send again */
+			rvt_put_ss(&qp->r_sge);
 			goto rnr_nak;
+		}
 		wc.ex.imm_data = ohdr->u.rc.imm_data;
 		wc.wc_flags = IB_WC_WITH_IMM;
 		goto send_last;
diff --git a/drivers/infiniband/hw/qib/qib_rc.c b/drivers/infiniband/hw/qib/qib_rc.c
index fc8b885..4ddbcac 100644
--- a/drivers/infiniband/hw/qib/qib_rc.c
+++ b/drivers/infiniband/hw/qib/qib_rc.c
@@ -1956,8 +1956,10 @@ void qib_rc_rcv(struct qib_ctxtdata *rcd, struct ib_header *hdr,
 		ret = qib_get_rwqe(qp, 1);
 		if (ret < 0)
 			goto nack_op_err;
-		if (!ret)
+		if (!ret) {
+			rvt_put_ss(&qp->r_sge);
 			goto rnr_nak;
+		}
 		wc.ex.imm_data = ohdr->u.rc.imm_data;
 		hdrsize += 4;
 		wc.wc_flags = IB_WC_WITH_IMM;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 0/2] IB/hfi1,qib: Fixes for 4.12-rc
  2017-05-12 16:01 [PATCH 0/2] IB/hfi1,qib: Fixes for 4.12-rc Dennis Dalessandro
  2017-05-12 16:02 ` [PATCH 2/2] IB/qib, IB/hfi1: Fix MR reference count leak on write with immediate Dennis Dalessandro
@ 2017-06-01 22:12 ` Doug Ledford
  1 sibling, 0 replies; 3+ messages in thread
From: Doug Ledford @ 2017-06-01 22:12 UTC (permalink / raw)
  To: Dennis Dalessandro
  Cc: Mike Marciniszyn, Dean Luick, Jakub Byczkowski, Tadeusz Struk,
	linux-rdma, Stable

On Fri, 2017-05-12 at 09:01 -0700, Dennis Dalessandro wrote:
> Hi Doug,
> 
> Here are two patches that I think should be RC worthy. One fixes a
> bug where
> packets could be sent before the other side is ready. The other fixes
> an MR ref
> count leak for write-only-with-immediate when the buffer allocation
> for the
> immediate data fails. This one is in both qib and hfi1. Ideally we
> will move
> this code to rdmavt to get rid of the duplication but would like to
> get this fix
> out for RC and the stable kernels.
> 
> These apply on top of:
> 67cf362 : rxe: expose num_possible_cpus() cnum_comp_vectors
> 
> Patches can can also be found in my GitHub repo at:
> https://github.com/ddalessa/kernel/tree/for-4.12

Thanks, series applied.

-- 
Doug Ledford <dledford@redhat.com>
    GPG KeyID: B826A3330E572FDD
   
Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-06-01 22:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-12 16:01 [PATCH 0/2] IB/hfi1,qib: Fixes for 4.12-rc Dennis Dalessandro
2017-05-12 16:02 ` [PATCH 2/2] IB/qib, IB/hfi1: Fix MR reference count leak on write with immediate Dennis Dalessandro
2017-06-01 22:12 ` [PATCH 0/2] IB/hfi1,qib: Fixes for 4.12-rc Doug Ledford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).