From owner-cvs-src@FreeBSD.ORG Thu Oct 14 11:43:16 2004 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A31D216A4CE; Thu, 14 Oct 2004 11:43:16 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 962D243D67; Thu, 14 Oct 2004 11:43:16 +0000 (GMT) (envelope-from rwatson@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id i9EBhGDk095462; Thu, 14 Oct 2004 11:43:16 GMT (envelope-from rwatson@repoman.freebsd.org) Received: (from rwatson@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i9EBhG0H095461; Thu, 14 Oct 2004 11:43:16 GMT (envelope-from rwatson) Message-Id: <200410141143.i9EBhG0H095461@repoman.freebsd.org> From: Robert Watson Date: Thu, 14 Oct 2004 11:43:16 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: RELENG_5 Subject: cvs commit: src/sys/kern uipc_socket.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Oct 2004 11:43:16 -0000 rwatson 2004-10-14 11:43:16 UTC FreeBSD src repository Modified files: (Branch: RELENG_5) sys/kern uipc_socket.c Log: Merge uipc_socket.c:1.213 from HEAD to RELENG_5: date: 2004/10/11 08:11:26; author: rwatson; state: Exp; lines: +19 -5 Rework sofree() logic to take into account a possible race with accept(). Sockets in the listen queues have reference counts of 0, so if the protocol decides to disconnect the pcb and try to free the socket, this triggered a race with accept() wherein accept() would bump the reference count before sofree() had removed the socket from the listen queues, resulting in a panic in sofree() when it discovered it was freeing a referenced socket. This might happen if a RST came in prior to accept() on a TCP connection. The fix is two-fold: to expand the coverage of the accept mutex earlier in sofree() to prevent accept() from grabbing the socket after the "is it really safe to free" tests, and to expand the logic of the "is it really safe to free" tests to check that the refcount is still 0 (i.e., we didn't race). RELENG_5 candidate. Much discussion with and work by: green Reported by: Marc UBM Bocklet Reported by: Vlad Note that this fix is not yet confirmed by submitters to correct the specific symptom they are seeing, but does correct a known problem. Approved by: re (scottl) Revision Changes Path 1.208.2.3 +19 -5 src/sys/kern/uipc_socket.c