Skip to content

Commit

Permalink
IB/rdmavt: Only put mmap_info ref if it exists
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jim Foraker authored and Doug Ledford committed Dec 14, 2016
1 parent f5eabf5 commit 22dccc5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/infiniband/sw/rdmavt/qp.c
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,8 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
return ret;

bail_ip:
kref_put(&qp->ip->ref, rvt_release_mmap_info);
if (qp->ip)
kref_put(&qp->ip->ref, rvt_release_mmap_info);

bail_qpn:
free_qpn(&rdi->qp_dev->qpn_table, qp->ibqp.qp_num);
Expand Down

0 comments on commit 22dccc5

Please sign in to comment.