ipfw: don't recurse on the upper half lock in ipfw_iface_ref()
Fixes: e3caa360d5
This commit is contained in:
@@ -246,13 +246,13 @@ vnet_ipfw_iface_init(struct ip_fw_chain *ch)
|
||||
{
|
||||
struct namedobj_instance *ii;
|
||||
|
||||
IPFW_UH_WLOCK_ASSERT(ch);
|
||||
|
||||
ii = ipfw_objhash_create(DEFAULT_IFACES, DEFAULT_OBJHASH_SIZE);
|
||||
IPFW_UH_WLOCK(ch);
|
||||
if (ch->ifcfg == NULL) {
|
||||
ch->ifcfg = ii;
|
||||
ii = NULL;
|
||||
}
|
||||
IPFW_UH_WUNLOCK(ch);
|
||||
|
||||
if (ii != NULL) {
|
||||
/* Already initialized. Free namehash. */
|
||||
@@ -296,9 +296,7 @@ vnet_ipfw_iface_destroy(struct ip_fw_chain *ch)
|
||||
|
||||
/*
|
||||
* Notify the subsystem that we are interested in tracking
|
||||
* interface @name. This function has to be called without
|
||||
* holding any locks to permit allocating the necessary states
|
||||
* for proper interface tracking.
|
||||
* interface @name.
|
||||
*
|
||||
* Returns 0 on success.
|
||||
*/
|
||||
@@ -309,11 +307,11 @@ ipfw_iface_ref(struct ip_fw_chain *ch, char *name,
|
||||
struct namedobj_instance *ii;
|
||||
struct ipfw_iface *iif, *tmp;
|
||||
|
||||
IPFW_UH_WLOCK_ASSERT(ch);
|
||||
|
||||
if (strlen(name) >= sizeof(iif->ifname))
|
||||
return (EINVAL);
|
||||
|
||||
IPFW_UH_WLOCK(ch);
|
||||
|
||||
ii = CHAIN_TO_II(ch);
|
||||
if (ii == NULL) {
|
||||
/*
|
||||
@@ -329,7 +327,6 @@ ipfw_iface_ref(struct ip_fw_chain *ch, char *name,
|
||||
if (iif != NULL) {
|
||||
iif->no.refcnt++;
|
||||
ic->iface = iif;
|
||||
IPFW_UH_WUNLOCK(ch);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -352,7 +349,6 @@ ipfw_iface_ref(struct ip_fw_chain *ch, char *name,
|
||||
/* Interface has been created since unlock. Ref and return */
|
||||
tmp->no.refcnt++;
|
||||
ic->iface = tmp;
|
||||
IPFW_UH_WUNLOCK(ch);
|
||||
free(iif, M_IPFW);
|
||||
return (0);
|
||||
}
|
||||
@@ -364,8 +360,6 @@ ipfw_iface_ref(struct ip_fw_chain *ch, char *name,
|
||||
ipfw_objhash_add(ii, &iif->no);
|
||||
ic->iface = iif;
|
||||
|
||||
IPFW_UH_WUNLOCK(ch);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user