Skip to content

Commit

Permalink
IB/rdmvat: Fix double vfree() in rvt_create_qp() error path
Browse files Browse the repository at this point in the history
The unwind logic for creating a user QP has a double vfree
of the non-shared receive queue when handling a "too many qps"
failure.

The code unwinds the mmmap info by decrementing a reference
count which will call rvt_release_mmap_info() which in turn
does the vfree() of the r_rq.wq.  The unwind code then does
the same free.

Fix by guarding the vfree() with the same test that is done
in close and only do the vfree() if qp->ip is NULL.

Reviewed-by: Dennis Dalessandro <[email protected]>
Signed-off-by: Mike Marciniszyn <[email protected]>
Signed-off-by: Dennis Dalessandro <[email protected]>
Signed-off-by: Doug Ledford <[email protected]>
  • Loading branch information
mmarcini authored and dledford committed Aug 22, 2016
1 parent 08fe16f commit 56c8ca5
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 @@ -873,7 +873,8 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
free_qpn(&rdi->qp_dev->qpn_table, qp->ibqp.qp_num);

bail_rq_wq:
vfree(qp->r_rq.wq);
if (!qp->ip)
vfree(qp->r_rq.wq);

bail_driver_priv:
rdi->driver_f.qp_priv_free(rdi, qp);
Expand Down

0 comments on commit 56c8ca5

Please sign in to comment.