From owner-svn-src-head@freebsd.org Fri Jul 29 20:39:33 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A3B35BA82C9; Fri, 29 Jul 2016 20:39:33 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7034F13DB; Fri, 29 Jul 2016 20:39:33 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6TKdWN4057836; Fri, 29 Jul 2016 20:39:32 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6TKdWkA057835; Fri, 29 Jul 2016 20:39:32 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201607292039.u6TKdWkA057835@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 29 Jul 2016 20:39:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303507 - head/sys/ofed/drivers/infiniband/ulp/sdp X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jul 2016 20:39:33 -0000 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);