From owner-p4-projects@FreeBSD.ORG Tue Oct 21 15:19:29 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 8FC8D16A4C0; Tue, 21 Oct 2003 15:19:29 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6A01F16A4B3 for ; Tue, 21 Oct 2003 15:19:29 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id ACB4E43F3F for ; Tue, 21 Oct 2003 15:19:28 -0700 (PDT) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.9/8.12.9) with ESMTP id h9LMJSXJ013168 for ; Tue, 21 Oct 2003 15:19:28 -0700 (PDT) (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.9/8.12.9/Submit) id h9LMJSW9013165 for perforce@freebsd.org; Tue, 21 Oct 2003 15:19:28 -0700 (PDT) (envelope-from sam@freebsd.org) Date: Tue, 21 Oct 2003 15:19:28 -0700 (PDT) Message-Id: <200310212219.h9LMJSW9013165@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Subject: PERFORCE change 40125 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2003 22:19:30 -0000 http://perforce.freebsd.org/chv.cgi?CH=40125 Change 40125 by sam@sam_ebb on 2003/10/21 15:19:09 apply bandaid to locking problem in divert sockets Affected files ... .. //depot/projects/netperf/sys/netinet/ip_divert.c#6 edit Differences ... ==== //depot/projects/netperf/sys/netinet/ip_divert.c#6 (text+ko) ==== @@ -219,6 +219,20 @@ m->m_pkthdr.rcvif->if_unit); } + /* + * XXX sbappendaddr must be protected by Giant until + * we have locking at the socket layer. When entered + * from below we come in w/o Giant and must take it + * here. Unfortunately we cannot tell whether we're + * entering from above (already holding Giant), + * below (potentially without Giant), or otherwise + * (e.g. from tcp_syncache through a timeout) so we + * have to grab it regardless. This causes a LOR with + * the tcp lock, at least, and possibly others. For + * the moment we're ignoring this. Once sockets are + * locked this cruft can be removed. + */ + mtx_lock(&Giant); /* XXX */ /* Put packet on socket queue, if any */ sa = NULL; nport = htons((u_int16_t)port); @@ -240,6 +254,7 @@ INP_UNLOCK(inp); } INP_INFO_RUNLOCK(&divcbinfo); + mtx_unlock(&Giant); /* XXX */ if (sa == NULL) { m_freem(m); ipstat.ips_noproto++;