Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Aug 2005 01:49:03 +0900
From:      Hajimu UMEMOTO <ume@FreeBSD.org>
To:        John Baldwin <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
Message-ID:  <ygevf24mruo.wl%ume@mahoroba.org>
In-Reply-To: <200508161559.24097.jhb@FreeBSD.org>
References:  <200508161949.j7GJnAaG015685@repoman.freebsd.org> <200508161559.24097.jhb@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

>>>>> On Tue, 16 Aug 2005 15:59:22 -0400
>>>>> John Baldwin <jhb@FreeBSD.org> 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/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ygevf24mruo.wl%ume>