All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] IB/rdmavt: Only put mmap_info ref if it exists
@ 2016-11-01 20:44 Jim Foraker
       [not found] ` <1478033052-147252-1-git-send-email-foraker1-i2BcT+NCU+M@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Jim Foraker @ 2016-11-01 20:44 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Dennis Dalessandro, Jim Foraker

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-i2BcT+NCU+M@public.gmane.org>
---
 drivers/infiniband/sw/rdmavt/qp.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/infiniband/sw/rdmavt/qp.c b/drivers/infiniband/sw/rdmavt/qp.c
index 6500c3b..0004e8b 100644
--- a/drivers/infiniband/sw/rdmavt/qp.c
+++ b/drivers/infiniband/sw/rdmavt/qp.c
@@ -884,7 +884,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);
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2016-12-14 16:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-01 20:44 [PATCH] IB/rdmavt: Only put mmap_info ref if it exists Jim Foraker
     [not found] ` <1478033052-147252-1-git-send-email-foraker1-i2BcT+NCU+M@public.gmane.org>
2016-11-02 15:17   ` Dalessandro, Dennis
2016-11-02 15:40   ` Leon Romanovsky
2016-11-04 17:33   ` Jonathan Toppins
     [not found]     ` <b67230ae-baf0-c932-4acd-b414a33c158f-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-12-01 13:29       ` Estrin, Alex
2016-12-14 16:51   ` Doug Ledford

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.