linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] infiniband/qedr: Potential null ptr dereference of qp
@ 2018-12-24 18:24 Aditya Pakki
  2018-12-25  4:26 ` Leon Romanovsky
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Aditya Pakki @ 2018-12-24 18:24 UTC (permalink / raw)
  To: pakki001
  Cc: kjlu, Michal Kalderon, Ariel Elior, Doug Ledford,
	Jason Gunthorpe, linux-rdma, linux-kernel

idr_find() may fail and return a NULL pointer. The fix checks the
return value of the function and returns an error in case of NULL.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
---
 drivers/infiniband/hw/qedr/qedr_iw_cm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/infiniband/hw/qedr/qedr_iw_cm.c b/drivers/infiniband/hw/qedr/qedr_iw_cm.c
index 505fa3648762..93b16237b767 100644
--- a/drivers/infiniband/hw/qedr/qedr_iw_cm.c
+++ b/drivers/infiniband/hw/qedr/qedr_iw_cm.c
@@ -492,6 +492,8 @@ int qedr_iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
 	int i;
 
 	qp = idr_find(&dev->qpidr.idr, conn_param->qpn);
+	if (unlikely(!qp))
+		return -EINVAL;
 
 	laddr = (struct sockaddr_in *)&cm_id->m_local_addr;
 	raddr = (struct sockaddr_in *)&cm_id->m_remote_addr;
-- 
2.17.1

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

end of thread, other threads:[~2019-01-02 23:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-24 18:24 [PATCH] infiniband/qedr: Potential null ptr dereference of qp Aditya Pakki
2018-12-25  4:26 ` Leon Romanovsky
2018-12-25 13:13 ` [EXT] " Michal Kalderon
2019-01-02 23:28 ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).