PERFORCE change 109130 for review
Paolo Pisati
piso at FreeBSD.org
Fri Nov 3 16:53:44 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=109130
Change 109130 by piso at piso_newluxor on 2006/11/03 16:52:54
Close a small race: use a stack variable instead of returning
a reference to a field inside the libalias struct (that is
no more protected by the lock).
Affected files ...
.. //depot/projects/soc2005/libalias/sys/netinet/libalias/alias_db.c#15 edit
Differences ...
==== //depot/projects/soc2005/libalias/sys/netinet/libalias/alias_db.c#15 (text+ko) ====
@@ -2613,15 +2613,14 @@
* do a probe for flag values) */
)
{
+ int res = -1;
LIBALIAS_LOCK(la);
/* Enable logging? */
if (flags & mask & PKT_ALIAS_LOG) {
/* Do the enable */
- if (InitPacketAliasLog(la) == ENOMEM) {
- LIBALIAS_UNLOCK(la);
- return (-1);
- }
+ if (InitPacketAliasLog(la) == ENOMEM)
+ goto getout;
} else
/* _Disable_ logging? */
if (~flags & mask & PKT_ALIAS_LOG) {
@@ -2640,8 +2639,10 @@
/* Other flags can be set/cleared without special action */
la->packetAliasMode = (flags & mask) | (la->packetAliasMode & ~mask);
+ res = la->packetAliasMode;
+getout:
LIBALIAS_UNLOCK(la);
- return (la->packetAliasMode);
+ return (res);
}
More information about the p4-projects
mailing list