summaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/qedr
diff options
context:
space:
mode:
authorAditya Pakki <pakki001@umn.edu>2018-12-24 12:24:45 -0600
committerJason Gunthorpe <jgg@mellanox.com>2019-01-02 16:08:38 -0700
commit9c6260de505b63638dd86fcc33849b17f6146d94 (patch)
tree4a3aeb7be3332b76b16ab1778a9eba8abc1527b6 /drivers/infiniband/hw/qedr
parent94edd87a1c59f3efa6fdf4e98d6d492e6cec6173 (diff)
downloadlinux-9c6260de505b63638dd86fcc33849b17f6146d94.tar.bz2
infiniband/qedr: Potential null ptr dereference of qp
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> Acked-by: Michal Kalderon <michal.kalderon@marvell.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/hw/qedr')
-rw-r--r--drivers/infiniband/hw/qedr/qedr_iw_cm.c2
1 files changed, 2 insertions, 0 deletions
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;