If sdp_add_device() fails, there is no client data stored in the IB device,
leading to a kernel crash when a connection is being established. Fix this
by rejecting connections when the device is not initialized.
Also, fix a bad goto target in an error case early in sdp_init_qp().
Signed-off-by: Joachim Fenkes <fenkes@de.ibm.com>
Signed-off-by: Amir Vadai <amirv@mellanox.co.il>
sdp_warn(sk, "recv sge's. capability: %d needed: %ld\n",
sdp_sk(sk)->max_sge, SDP_MAX_RECV_SKB_FRAGS + 1);
rc = -ENOMEM;
- goto err_tx;
+ goto err_rx;
}
qp_init_attr.cap.max_send_sge = sdp_sk(sk)->max_sge;
sdp_dbg(sk, "Setting max send sge to: %d\n", sdp_sk(sk)->max_sge);
sdp_sk(sk)->sdp_dev = ib_get_client_data(device, &sdp_client);
+ if (!sdp_sk(sk)->sdp_dev) {
+ sdp_warn(sk, "SDP not available on device %s\n", device->name);
+ rc = -ENODEV;
+ goto err_rx;
+ }
rc = sdp_rx_ring_create(sdp_sk(sk), device);
if (rc)