]> git.baikalelectronics.ru Git - kernel.git/commitdiff
infiniband/qedr: Potential null ptr dereference of qp
authorAditya Pakki <pakki001@umn.edu>
Mon, 24 Dec 2018 18:24:45 +0000 (12:24 -0600)
committerJason Gunthorpe <jgg@mellanox.com>
Wed, 2 Jan 2019 23:08:38 +0000 (16:08 -0700)
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>
drivers/infiniband/hw/qedr/qedr_iw_cm.c

index 505fa36487629ce003b1ac78a2414efbe18e4195..93b16237b76774c986580792b7160cd7a9c85c3e 100644 (file)
@@ -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;