RDMA/srp: Fix NULL deref at srp_destroy_qp()

If srp_init_qp() fails at srp_create_ch_ib() then ch->send_cq
may be NULL.
Calling directly to ib_destroy_qp() is sufficient because
no work requests were posted on the created qp.

Fixes: 9294000d6d ("IB/srp: Drain the send queue before destroying a QP")
Cc: <[email protected]>
Signed-off-by: Israel Rukshin <[email protected]>
Reviewed-by: Max Gurtovoy <[email protected]>
Reviewed-by: Bart van Assche <[email protected]>--
Signed-off-by: Doug Ledford <[email protected]>
This commit is contained in:
Israel Rukshin 2017-05-11 18:52:36 +03:00 • committed by Doug Ledford
commit 95c2ef50c7

View file

@ -575,7 +575,7 @@ static int srp_create_ch_ib(struct srp_rdma_ch *ch)
return 0;
err_qp:
srp_destroy_qp(ch, qp);
ib_destroy_qp(qp);
err_send_cq:
ib_free_cq(send_cq);