From a3c0b052b774ede4ade8a03bc9db60797e9b364e Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Fri, 29 Jul 2016 20:39:32 +0000 Subject: [PATCH] sdp: Use the PCB as the rx completion handler argument. The generic socket may be detached from the PCB before the completion queue is drained and destroyed, so this change closes a race condition in connection teardown. Sponsored by: EMC / Isilon Storage Division --- sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c b/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c index f00ae687ebb4..3cb90d04a671 100644 --- a/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c +++ b/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c @@ -665,13 +665,10 @@ sdp_process_rx(struct sdp_sock *ssk) static void sdp_rx_irq(struct ib_cq *cq, void *cq_context) { - struct socket *sk = cq_context; - struct sdp_sock *ssk = sdp_sk(sk); + struct sdp_sock *ssk; - if (cq != ssk->rx_ring.cq) { - sdp_dbg(sk, "cq = %p, ssk->cq = %p\n", cq, ssk->rx_ring.cq); - return; - } + ssk = cq_context; + KASSERT(cq == ssk->rx_ring.cq, ("%s: mismatched cq on %p", ssk)); SDPSTATS_COUNTER_INC(rx_int_count); @@ -728,7 +725,7 @@ sdp_rx_ring_create(struct sdp_sock *ssk, struct ib_device *device) } rx_cq = ib_create_cq(device, sdp_rx_irq, sdp_rx_cq_event_handler, - ssk->socket, SDP_RX_SIZE, 0); + ssk, SDP_RX_SIZE, 0); if (IS_ERR(rx_cq)) { rc = PTR_ERR(rx_cq);