]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
RDMA/qib,hfi1: Fix MR reference count leak on write with immediate
authorMike Marciniszyn <mike.marciniszyn@intel.com>
Fri, 12 May 2017 16:02:00 +0000 (09:02 -0700)
committerThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Tue, 27 Jun 2017 13:16:32 +0000 (10:16 -0300)
commitf8144371a4336542f41e283ac165c8d3e91408e9
treed5f2a6e6e7105f42f670456bdbbfb173693b3f7d
parentcc133facc44ff213b6f5201c691ea2734ed435ed
RDMA/qib,hfi1: Fix MR reference count leak on write with immediate

BugLink: http://bugs.launchpad.net/bugs/1698799
commit 1feb40067cf04ae48d65f728d62ca255c9449178 upstream.

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>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
drivers/infiniband/hw/qib/qib_rc.c