From owner-svn-src-projects@FreeBSD.ORG Thu Aug 14 08:42:17 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 871AD616; Thu, 14 Aug 2014 08:42:17 +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 73E0E2625; Thu, 14 Aug 2014 08:42:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7E8gHlD065972; Thu, 14 Aug 2014 08:42:17 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7E8gHnE065971; Thu, 14 Aug 2014 08:42:17 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201408140842.s7E8gHnE065971@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Thu, 14 Aug 2014 08:42:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r269966 - 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, 14 Aug 2014 08:42:17 -0000 Author: melifaro Date: Thu Aug 14 08:42:16 2014 New Revision: 269966 URL: http://svnweb.freebsd.org/changeset/base/269966 Log: Fix crash in case of iflist request on non-initialized tracker. Modified: projects/ipfw/sys/netpfil/ipfw/ip_fw_iface.c Modified: projects/ipfw/sys/netpfil/ipfw/ip_fw_iface.c ============================================================================== --- projects/ipfw/sys/netpfil/ipfw/ip_fw_iface.c Thu Aug 14 08:21:22 2014 (r269965) +++ projects/ipfw/sys/netpfil/ipfw/ip_fw_iface.c Thu Aug 14 08:42:16 2014 (r269966) @@ -489,6 +489,7 @@ export_iface_internal(struct namedobj_in 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, 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, 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); } -