IB/rdmavt: Only put mmap_info ref if it exists
authorJim Foraker <foraker1@llnl.gov>
Tue, 1 Nov 2016 20:44:12 +0000 (13:44 -0700)
committerDoug Ledford <dledford@redhat.com>
Wed, 14 Dec 2016 17:16:11 +0000 (12:16 -0500)
commit22dccc5454a39427de7b87a080d026b6bf66a7b9
tree3d0d33f5d42f44c114fb98b26f7f998f129fddf3
parentf5eabf5e5129e8ab5b3e7f50b24444aca1680e64
IB/rdmavt: Only put mmap_info ref if it exists

rvt_create_qp() creates qp->ip only when a qp creation request comes from
userspace (udata is not NULL).  If we exceed the number of available
queue pairs however, the error path always attempts to put a kref to this
structure.  If the requestor is inside the kernel, this leads to a crash.

We fix this by checking that qp->ip is not NULL before caling kref_put().

Signed-off-by: Jim Foraker <foraker1@llnl.gov>
Acked-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Acked-by: Jonathan Toppins <jtoppins@redhat.com>
Acked-by: Alex Estrin <alex.estrin@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/sw/rdmavt/qp.c