Author: markj
Date: Fri Jul 29 20:39:32 2016
New Revision: 303507
URL: https://svnweb.freebsd.org/changeset/base/303507

Log:
  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

Modified:
  head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c

Modified: head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c
==============================================================================
--- head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c   Fri Jul 29 20:36:01 
2016        (r303506)
+++ head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c   Fri Jul 29 20:39:32 
2016        (r303507)
@@ -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,
        }
 
        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);
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to