From e948489558dbfbbc20c5f7dc600441956ca6f167 Mon Sep 17 00:00:00 2001 From: "Alexander V. Chernikov" Date: Tue, 28 Apr 2015 17:05:55 +0000 Subject: [PATCH] Fix panic introduced by r282070. Arm friendly KASSERT() to ease debug of similar crashes. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Submitted by: Olivier Cochard-Labbé --- sys/netpfil/ipfw/ip_fw_sockopt.c | 1 - sys/netpfil/ipfw/ip_fw_table.c | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/netpfil/ipfw/ip_fw_sockopt.c b/sys/netpfil/ipfw/ip_fw_sockopt.c index 94fe09fbfb94..d618a6c615b3 100644 --- a/sys/netpfil/ipfw/ip_fw_sockopt.c +++ b/sys/netpfil/ipfw/ip_fw_sockopt.c @@ -1647,7 +1647,6 @@ check_ipfw_rule_body(ipfw_insn *cmd, int cmd_len, struct rule_check_info *ci) return EINVAL; if (cmdlen != F_INSN_SIZE(ipfw_insn_nat)) goto bad_size; - ci->object_opcodes++; goto check_action; case O_FORWARD_MAC: /* XXX not implemented yet */ case O_CHECK_STATE: diff --git a/sys/netpfil/ipfw/ip_fw_table.c b/sys/netpfil/ipfw/ip_fw_table.c index 7858c78f04b6..8b15a93fcba7 100644 --- a/sys/netpfil/ipfw/ip_fw_table.c +++ b/sys/netpfil/ipfw/ip_fw_table.c @@ -3399,6 +3399,10 @@ ref_rule_objects(struct ip_fw_chain *ch, struct ip_fw *rule, IPFW_UH_WUNLOCK(ch); + KASSERT(found + unresolved == ci->object_opcodes, + ("refcount incosistency: found: %d unr: %d total: %d", + found, unresolved, ci->object_opcodes)); + /* Perform auto-creation for non-existing objects */ if (numnew != 0) error = create_objects_compat(ch, rule->cmd, oib, pidx, ti);