From owner-cvs-all@FreeBSD.ORG Tue Aug 16 20:22:55 2005 Return-Path: X-Original-To: cvs-all@FreeBSD.org Delivered-To: cvs-all@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 02E8116A42F; Tue, 16 Aug 2005 20:22:55 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: from mv.twc.weather.com (mv.twc.weather.com [65.212.71.225]) by mx1.FreeBSD.org (Postfix) with ESMTP id F341A43D46; Tue, 16 Aug 2005 20:22:53 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: from [10.50.40.201] (Not Verified[10.50.40.201]) by mv.twc.weather.com with NetIQ MailMarshal (v6, 0, 3, 8) id ; Tue, 16 Aug 2005 16:37:51 -0400 From: John Baldwin To: Hajimu UMEMOTO Date: Tue, 16 Aug 2005 15:59:22 -0400 User-Agent: KMail/1.8 References: <200508161949.j7GJnAaG015685@repoman.freebsd.org> In-Reply-To: <200508161949.j7GJnAaG015685@repoman.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-6" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200508161559.24097.jhb@FreeBSD.org> Cc: cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/netinet6 in6_src.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2005 20:22:55 -0000 On Tuesday 16 August 2005 03:49 pm, Hajimu UMEMOTO wrote: > ume 2005-08-16 19:49:10 UTC > > FreeBSD src repository > > Modified files: > sys/netinet6 in6_src.c > Log: > avoid exclusive sleep mutex. 1) This should be using TAILQ_FOREACH() to be more readable. 2) It's not safe to drop the lock here as you've done as the list can change out from under you. You might be able to use TAILQ_FOREACH_SAFE() if you know what the next entry in the can't be removed from the list while the lock is dropped, but that's usually not an easy thing to ensure unless you set a flag or some such while holding the lock to communicate that to the code that adds and removes items to this list. You may need to use an sx lock here rather than a mutex. As it is, this change opens up a race condition that can result in deref'ing bogus pointers and kernel panics. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org