Date: Thu, 29 Jan 2004 23:22:02 +0000 From: "David W. Hankins" <David_Hankins@isc.org> To: freebsd-current@freebsd.org Subject: 5.2-rel, route.c question Message-ID: <20040129232201.GD56062@isc.org>
next in thread | raw e-mail | index | archive | help
While looking at rtalloc1 in depth, trying to figure out the recursive lock Peter mailed here a little while ago, I noticed something unrelated about rtalloc1 I was hoping someone could explain to me. At route.c:161 (cvs vers 1.92.2.1), I notice that it locks the rt pointer it plans on returning, but does not inc the reference count. The other two execution paths of rtalloc1 both lock & inc the ref count. And later, in rtrequest1 (route.c:784), a call to rtalloc1 is made, and in one case RTFREE_LOCKED(rt) is used, in the other rtexpunge is used which looks safe to me either way. but... IFF rtalloc1 did not RT_ADDREF(), AND rtrequest1 RTFREE_LOCKED()'s it, then will the rt not be freed out from under the other reference? And badness can then ensue? I'm hoping someone more familiar with the code can tell me I'm wrong. I've never read a line of it until today, so it's probable I'm just confused. -- David W. Hankins "If you don't do it right the first time, you'll just have to do it again." -- Jack T. Hankins
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040129232201.GD56062>