RDMA/siw: Fix potential NULL de-ref
authorBernard Metzler <bmt@zurich.ibm.com>
Mon, 19 Aug 2019 14:02:57 +0000 (16:02 +0200)
committerDoug Ledford <dledford@redhat.com>
Tue, 20 Aug 2019 17:44:44 +0000 (13:44 -0400)
In siw_connect() we have an error flow where there is no valid qp
pointer.  Make sure we don't try to de-ref in that situation.

Fixes: 6c52fdc244b5 ("rdma/siw: connection management")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Bernard Metzler <bmt@zurich.ibm.com>
Link: https://lore.kernel.org/r/20190819140257.19319-1-bmt@zurich.ibm.com
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/sw/siw/siw_cm.c

index 9ce8a1b925d26306f18038c613c69ef09f5983bc..fc97571a640b0fde0d2f4a9326e0bf31c2aee765 100644 (file)
@@ -1515,7 +1515,7 @@ int siw_connect(struct iw_cm_id *id, struct iw_cm_conn_param *params)
                }
        }
 error:
-       siw_dbg_qp(qp, "failed: %d\n", rv);
+       siw_dbg(id->device, "failed: %d\n", rv);
 
        if (cep) {
                siw_socket_disassoc(s);
@@ -1540,7 +1540,8 @@ error:
        } else if (s) {
                sock_release(s);
        }
-       siw_qp_put(qp);
+       if (qp)
+               siw_qp_put(qp);
 
        return rv;
 }