From owner-svn-src-projects@FreeBSD.ORG Thu Oct 9 14:33:21 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BE14FD56; Thu, 9 Oct 2014 14:33:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 906696EB; Thu, 9 Oct 2014 14:33:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s99EXLPr016912; Thu, 9 Oct 2014 14:33:21 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s99EXLcE016911; Thu, 9 Oct 2014 14:33:21 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201410091433.s99EXLcE016911@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Thu, 9 Oct 2014 14:33:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r272821 - projects/ipfw/sys/netpfil/ipfw X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 14:33:21 -0000 Author: melifaro Date: Thu Oct 9 14:33:20 2014 New Revision: 272821 URL: https://svnweb.freebsd.org/changeset/base/272821 Log: Fix core on table destroy inroduced by table values code. Rename @ti array copy to 'ti_copy'. Modified: projects/ipfw/sys/netpfil/ipfw/ip_fw_table.c Modified: projects/ipfw/sys/netpfil/ipfw/ip_fw_table.c ============================================================================== --- projects/ipfw/sys/netpfil/ipfw/ip_fw_table.c Thu Oct 9 13:58:19 2014 (r272820) +++ projects/ipfw/sys/netpfil/ipfw/ip_fw_table.c Thu Oct 9 14:33:20 2014 (r272821) @@ -85,7 +85,7 @@ struct table_config { char tablename[64]; /* table name */ struct table_algo *ta; /* Callbacks for given algo */ void *astate; /* algorithm state */ - struct table_info ti; /* data to put to table_info */ + struct table_info ti_copy; /* data to put to table_info */ struct namedobj_instance *vi; }; @@ -1277,7 +1277,7 @@ restart: astate_old = tc->astate; tc->astate = astate_new; - tc->ti = ti_new; + tc->ti_copy = ti_new; tc->count = 0; /* Notify algo on real @ti address */ @@ -1430,8 +1430,8 @@ swap_tables(struct ip_fw_chain *ch, stru IPFW_WUNLOCK(ch); /* Ensure tc.ti copies are in sync */ - tc_a->ti = tablestate[tc_a->no.kidx]; - tc_b->ti = tablestate[tc_b->no.kidx]; + tc_a->ti_copy = tablestate[tc_a->no.kidx]; + tc_b->ti_copy = tablestate[tc_b->no.kidx]; /* Notify both tables on @ti change */ if (tc_a->ta->change_ti != NULL) @@ -1481,8 +1481,7 @@ destroy_table(struct ip_fw_chain *ch, st tc->no.kidx, tc->tablename); /* Unref values used in tables while holding UH lock */ - ipfw_unref_table_values(ch, tc, tc->ta, tc->astate, - &((struct table_info *)ch->tablestate)[tc->no.kidx]); + ipfw_unref_table_values(ch, tc, tc->ta, tc->astate, &tc->ti_copy); IPFW_UH_WUNLOCK(ch); free_table_config(ni, tc); @@ -3008,7 +3007,7 @@ alloc_table_config(struct ip_fw_chain *c } /* Preallocate data structures for new tables */ - error = ta->init(ch, &tc->astate, &tc->ti, aname, tflags); + error = ta->init(ch, &tc->astate, &tc->ti_copy, aname, tflags); if (error != 0) { free(tc, M_IPFW); return (NULL); @@ -3030,7 +3029,7 @@ free_table_config(struct namedobj_instan * We're using ta without any locking/referencing. * TODO: fix this if we're going to use unloadable algos. */ - tc->ta->destroy(tc->astate, &tc->ti); + tc->ta->destroy(tc->astate, &tc->ti_copy); free(tc, M_IPFW); } @@ -3054,7 +3053,7 @@ link_table(struct ip_fw_chain *ch, struc ipfw_objhash_add(ni, &tc->no); ti = KIDX_TO_TI(ch, kidx); - *ti = tc->ti; + *ti = tc->ti_copy; /* Notify algo on real @ti address */ if (tc->ta->change_ti != NULL)