summaryrefslogtreecommitdiffstats
path: root/sys/netpfil/ipfw
diff options
context:
space:
mode:
authormelifaro <melifaro@FreeBSD.org>2014-08-14 08:42:16 +0000
committermelifaro <melifaro@FreeBSD.org>2014-08-14 08:42:16 +0000
commitac476df0ec177e4282b5efedf8953d6e0fac8379 (patch)
tree9391ae03261c8aaa36f28abe5e61c13ba27752e9 /sys/netpfil/ipfw
parentef7f079c1d7f36e2bb6036dac3ea4e53276f2873 (diff)
downloadFreeBSD-src-ac476df0ec177e4282b5efedf8953d6e0fac8379.zip
FreeBSD-src-ac476df0ec177e4282b5efedf8953d6e0fac8379.tar.gz
Fix crash in case of iflist request on non-initialized tracker.
Diffstat (limited to 'sys/netpfil/ipfw')
-rw-r--r--sys/netpfil/ipfw/ip_fw_iface.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/netpfil/ipfw/ip_fw_iface.c b/sys/netpfil/ipfw/ip_fw_iface.c
index e9b61ce..2238e8e 100644
--- a/sys/netpfil/ipfw/ip_fw_iface.c
+++ b/sys/netpfil/ipfw/ip_fw_iface.c
@@ -489,6 +489,7 @@ export_iface_internal(struct namedobj_instance *ii, struct named_object *no,
int
ipfw_list_ifaces(struct ip_fw_chain *ch, struct sockopt_data *sd)
{
+ struct namedobj_instance *ii;
struct _ipfw_obj_lheader *olh;
struct dump_iface_args da;
uint32_t count, size;
@@ -500,7 +501,11 @@ ipfw_list_ifaces(struct ip_fw_chain *ch, struct sockopt_data *sd)
return (EINVAL);
IPFW_UH_RLOCK(ch);
- count = ipfw_objhash_count(CHAIN_TO_II(ch));
+ ii = CHAIN_TO_II(ch);
+ if (ii != NULL)
+ count = ipfw_objhash_count(ii);
+ else
+ count = 0;
size = count * sizeof(ipfw_iface_info) + sizeof(ipfw_obj_lheader);
/* Fill in header regadless of buffer size */
@@ -517,10 +522,10 @@ ipfw_list_ifaces(struct ip_fw_chain *ch, struct sockopt_data *sd)
da.ch = ch;
da.sd = sd;
- ipfw_objhash_foreach(CHAIN_TO_II(ch), export_iface_internal, &da);
+ if (ii != NULL)
+ ipfw_objhash_foreach(ii, export_iface_internal, &da);
IPFW_UH_RUNLOCK(ch);
return (0);
}
-
OpenPOWER on IntegriCloud