From owner-cvs-all@FreeBSD.ORG Wed Aug 17 16:49:35 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 0A4C416A41F; Wed, 17 Aug 2005 16:49:35 +0000 (GMT) (envelope-from ume@mahoroba.org) Received: from ameno.mahoroba.org (gw4.mahoroba.org [218.45.22.175]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6493243D48; Wed, 17 Aug 2005 16:49:33 +0000 (GMT) (envelope-from ume@mahoroba.org) Received: from kasuga.mahoroba.org (IDENT:/W0E3BxbK0GFGBm7vyuEAVl+mjrd2GdvNqRVpDVnAPUTfMrCadyttDkky06/275I@[IPv6:3ffe:501:185b:801a:20b:97ff:fe2e:b521]) (user=ume mech=CRAM-MD5 bits=0) by ameno.mahoroba.org (8.13.3/8.13.3) with ESMTP/inet6 id j7HGnHxF033374 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 18 Aug 2005 01:49:25 +0900 (JST) (envelope-from ume@mahoroba.org) Date: Thu, 18 Aug 2005 01:49:03 +0900 Message-ID: From: Hajimu UMEMOTO To: John Baldwin In-Reply-To: <200508161559.24097.jhb@FreeBSD.org> References: <200508161949.j7GJnAaG015685@repoman.freebsd.org> <200508161559.24097.jhb@FreeBSD.org> User-Agent: xcite1.38> Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.7 (=?ISO-8859-4?Q?Sanj=F2?=) APEL/10.6 Emacs/22.0.50 (i386-unknown-freebsd6.0) MULE/5.0 (SAKAKI) X-Operating-System: FreeBSD 6.0-BETA2 X-PGP-Key: http://www.imasy.or.jp/~ume/publickey.asc X-PGP-Fingerprint: 1F00 0B9E 2164 70FC 6DC5 BF5F 04E9 F086 BF90 71FE Organization: Internet Mutual Aid Society, YOKOHAMA MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0 (ameno.mahoroba.org [IPv6:3ffe:501:185b:8010::1]); Thu, 18 Aug 2005 01:49:27 +0900 (JST) X-Virus-Scanned: by amavisd-new X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.4 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on ameno.mahoroba.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: Wed, 17 Aug 2005 16:49:35 -0000 Hi, >>>>> On Tue, 16 Aug 2005 15:59:22 -0400 >>>>> John Baldwin said: jhb> 1) This should be using TAILQ_FOREACH() to be more readable. jhb> 2) It's not safe to drop the lock here as you've done as the list can change jhb> out from under you. You might be able to use TAILQ_FOREACH_SAFE() if you jhb> know what the next entry in the can't be removed from the list while the lock jhb> is dropped, but that's usually not an easy thing to ensure unless you set a jhb> flag or some such while holding the lock to communicate that to the code that jhb> adds and removes items to this list. You may need to use an sx lock here jhb> rather than a mutex. jhb> As it is, this change opens up a race condition that can result in deref'ing jhb> bogus pointers and kernel panics. Thank you for your suggestion. I've committed the fix as your suggestion. If it is still wrong way, please let me know. Sincerely, -- Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan ume@mahoroba.org ume@{,jp.}FreeBSD.org http://www.imasy.org/~ume/